Insufficient Memory Errors running Batch file


  1. Posts : 17
    Windows 7 Home Premium 64bit
       #1

    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 Computer


  2. Posts : 5,656
    Windows 7 Ultimate x64 SP1
       #2

    You can try increasing pagefile size. Virtual Memory Paging File - Change
      My Computer


  3. Posts : 721
    Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
       #3

    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 Computer


  4. Posts : 17
    Windows 7 Home Premium 64bit
    Thread Starter
       #4

    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 Computer


  5. Posts : 721
    Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
       #5

    Code:
    for /F "delims=" %%I in (Prefix-List.txt) do (
    	robocopy "%src_folder%" "%dst_folder%" "%%~I*" /s >nul 2>>Errors.txt
    )
      My Computer


  6. Posts : 17
    Windows 7 Home Premium 64bit
    Thread Starter
       #6

    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.
    Last edited by jarhtmd; 29 Aug 2015 at 11:32. Reason: explain why I'm marking as Solved
      My Computer


  7. Posts : 721
    Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
       #7

    jarhtmd said:
    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.


    jarhtmd said:
    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 Computer


  8. Posts : 17
    Windows 7 Home Premium 64bit
    Thread Starter
       #8

    Pyprohly said:
    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 Computer


 

  Related Discussions
Our Sites
Site Links
About 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 17:51.
Find Us