Menu Close

Copying and deleting ST-Sim spatial files

Syncrosim Forums ST-Sim & State-and-Transition Simulation Models Copying and deleting ST-Sim spatial files

Tagged: ,

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #3788
    colin-danielcolin-daniel
    Keymaster

    It can be difficult to copy and delete the contents of an ST-Sim spatial output folder when there are a lot of small TIF files (e.g. for backup). Windows Explorer is not happy dealing with large numbers of files for either copy or delete, as it tries to enumerate all the files before the copy or delete even starts.

    My solution to this problem has been the following:
    1. To make a copy of files I use Windows robocopy command. This is a command that will copy entire folders from the Windows command line. My experience is that it is much faster than Windows Explorer
    2. To delete files: Use the second answer in this forum to subsequently delete the files: http://stackoverflow.com/questions/186737/whats-the-fastest-way-to-delete-a-large-folder-in-windows – this worked really well. Here is a copy of the relevant text from this post:

    The worst way is to send to Recycle Bin: you still need to delete them. Next worst is shift+delete with Windows Explorer: it wastes loads of time checking the contents before starting deleting anything.
    Next best is to use rmdir /s/q foldername from the command line. del /f/s/q foldername is good too, but it leaves behind the directory structure.
    The best I’ve found is a two line batch file with a first pass to delete files and outputs to nul to avoid the overhead of writing to screen for every singe file. A second pass then cleans up the remaining directory structure:
    del /f /s /q foldername > nul
    rmdir /s /q foldername
    This is nearly three times faster than a single rmdir, based on time tests with a Windows XP encrypted disk, deleting ~30GB/1,000,000 files/15,000 folders: rmdir takes ~2.5 hours, del+rmdirtakes ~53 minutes. More info at Super User.
    This is a regular task for me, so I usually move the stuff I need to delete to C:\stufftodelete and have those del+rmdir commands in a deletestuff.bat batch file. This is scheduled to run at night, but sometimes I need to run it during the day so the quicker the better.

    Hope this helps others – Colin

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.