Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Insufficient Memory Errors running Batch file

27 Aug 2015   #1
jarhtmd

Windows 7 Home Premium 64bit
 
 
Insufficient Memory Errors running Batch file

I have a batch file that . . .
1. reads a txt file that contains a list of filename prefixes.
2. drills down thru a folder tree looking for filesnames beginning with each of those prefixes.
3. copies (XCOPY) each matching file into a new folder tree (with matching subfolder structure).


It usually works great, but when searching a large tree of data with many subfolders, sub-subfolders and many files I get "insufficient memory" errors. I don't really understand what that means except that memory has not been "released". I get several of these errors.


I don't know if processing in OK to a certain point within the list of prefixes, and stops working (for the rest of the list) whenever an "insufficient memory" error occurs. Nor do I know the prefixes on which the errors occur.


Is there a way to prevent or recover from this problem? I assume it is related to the characteristics of the tree being searched.


My System SpecsSystem Spec
.
27 Aug 2015   #2
GokAy

Windows 7 Ultimate x64 SP1
 
 

You can try increasing pagefile size. Virtual Memory Paging File - Change
My System SpecsSystem Spec
28 Aug 2015   #3
Pyprohly

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
 
 

Feeding Xcopy a path that's longer than 254 characters may result in an 'insufficient memory' error. Long paths are not supported by Xcopy.

Use the Robocopy command instead.



reference: Xcopy: Insufficient Memory | Terminally Incoherent
My System SpecsSystem Spec
.

28 Aug 2015   #4
jarhtmd

Windows 7 Home Premium 64bit
 
 

Will you please translate this into a Robocopy command?

for /F "delims=" %%i in (Prefix-List.txt) do (
xcopy "%src_folder%\%%i*" "%dst_folder%" /C /H /I /K /Q /R /S /Y >nul 2>>Errors.txt
)
My System SpecsSystem Spec
29 Aug 2015   #5
Pyprohly

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
 
 

Code:
for /F "delims=" %%I in (Prefix-List.txt) do (
	robocopy "%src_folder%" "%dst_folder%" "%%~I*" /s >nul 2>>Errors.txt
)
My System SpecsSystem Spec
29 Aug 2015   #6
jarhtmd

Windows 7 Home Premium 64bit
 
 

Thanks. I used Dir /B /S /O:GN >dir.txt to get the full paths involved. Then after importing dir.txt into Excel I was able to find the very long paths. I shortened those & solved my immediate problem. Using Robocopy should prevent future problems.

This is the 1st that I've heard of Robocopy. Is there a list/catalog of similar commands?

* * * * *

I did not mark Pyprohly's post as "Solved", because I wasn't sure if I'd still be able to post this. Some forums don't allow additional posts after "Solved". My intent was to then go back to mark Pyprohly's post as the solution. Apparently, the last post is the only one that can be marked as a solution.

Therefore, I will mark this post as "Solved". Thanks again, Pyprohly.
My System SpecsSystem Spec
30 Aug 2015   #7
Pyprohly

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
 
 

Quote   Quote: Originally Posted by jarhtmd View Post
This is the 1st that I've heard of Robocopy. Is there a list/catalog of similar commands?
Copy, Xcopy, and Robocopy are the builtin Command Prompt commands that copy. For a list of all commands and their documentation, see this wonderful web resource.


Quote   Quote: Originally Posted by jarhtmd View Post
Some forums don't allow additional posts after "Solved". My intent was to then go back to mark Pyprohly's post as the solution. Apparently, the last post is the only one that can be marked as a solution.

Therefore, I will mark this post as "Solved". Thanks again, Pyprohly.
That's weird: not allowing users to continue posting after someone's solved it.

In this forum, at least, when you hit that 'Mark as Solved' button at the top of your thread, the whole thread is considered solved, and the person who actually 'solved' the problem is not displayed as such and is not recorded. When a thread is marked solved, the thread is marked solved, not a post.
My System SpecsSystem Spec
30 Aug 2015   #8
jarhtmd

Windows 7 Home Premium 64bit
 
 

Quote   Quote: Originally Posted by Pyprohly View Post
For a list of all commands and their documentation, see this wonderful web resource.
Thanks. That could open a whole new world of possibilities.
My System SpecsSystem Spec
Reply

 Insufficient Memory Errors running Batch file




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Defrag.exe won't run from a batch file. "Insufficient permission."
I want to defrag my C and E drives before Norton Ghost backs them up. Norton Ghost will run a batch file before the backup, so I made a simple one: C:\Windows\System32\Defrag.exe C: E: It won't run, however. I get an error message saying I have "insufficient permission" to run...
General Discussion
Can I set up a button to stop a batch file from running?
I have my machine set to hibernate at 2 AM in case I forget to turn it off. But sometimes I'll be up working or watching TV so I set up a batch file with a 60 second delay to abort it. Sometimes I'm in bed with a wireless mouse (no x rated pun intended) and no keyboard so I'll have to get up and...
Performance & Maintenance
Windows 7 creating blank txt file after running a batch script
I have the following batch script @echo off setlocal enableextensions set "baseName=dnshistory" set "count=0" for /f "delims=%baseName%." %%a in (
General Discussion
Insufficient Memory error
I'm having this error that says "Insufficient Memory, please close these programs to clear up some space." The CPU meter gadget says I'm using 96% of my RAM when this error occurs. Well, I've had this since I had Vista (I installed Win7 about 2 weeks ago). And I thought installing a new OS would...
Performance & Maintenance
Batch File that grabs file names from folder to insert into batch file
Ok I'm totally at a loss on how to word this so I'm just going to write it out the best that I can... :confused: First I have a batch file that I'm writing that will convert mp4 files to mp3 files (I have a lot) for a buddies band using ffmpeg. Here's the code that I'm using: ffmpeg -i...
General Discussion


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 13:46.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App