Move files and folders with ROBOCOPY in Windows 7
Posted on 2011-05-04
I am trying to use the robocopy utility to move folders and files
from one location to another, just like you would do if you were to
cut and paste. I think I am close but there are still bugs in the script below.
Example of what I need:
I want to move "ALL" the folders and files from C:\Test1 to D:\Test2 without
deleting the source directory C:\Test1 and making sure I keep the date stamp
and any other settings associated with these files and folders, this would
also include empty directories as well. So if I were to manually go to the
C:\Test1 directory and do a select all, and then hit the (Ctrl + X), and then
go to the D:\Test2 directory and do a "Ctrl + V" all my files and folders will
be moved to the D:Test2 with the same settings like date stamp, etc..... and it
will also include empty directories. I need my script to do what I just described
above in my manual process.
Also, I understand the script below will leave the "placeholder.txt" in the C:\Test1 source
directory and I am fine with that as long as everything else in that directory goes to the new
When I run the script below the /minage:5 syntax is being ignored by empty folders and they
are being copied to the destination instead of being moved. Again, I just want my script to do a simple "CUT" from one location and "PASTE" to another location. Please help.....
: Windows Batch File
robocopy %src% %dest% /MOVE /E /R:10 /XF "placeholder.txt" /TEE /minage:5 /DCOPY:T /LOG+:%log%