Requirements:
-
Windows 2000,XP Pro, 2003 Server
-
robocopy.exe- in the windows resource kits or download here (save as)
-
subinalc.exe- in the windows resource kits or download here (save as)
Conventions:
-
For this example we will assume that
-
robocopy.exe and subinacl.exe are in your local PATH
-
The C: drive is your main hard drive
-
I generally pull the harddrive out of the client computer and transfer the data from a workstion to our backup server using a removable drive tray.
-
the SOURCE is the F: Drive and is an NTFS file system. (if not NTFS, just remove the first line in the batch file below)
-
The SOURCE is NOT the partition that is running Windows currently.
-
the destination is a mapped network folder T:\test
Install both of these and then create a new text file called robocopy.cmd on your desktop.
Line 1 will use subinalc to take ownership of all the file on the SOURCE and give Everyone Full Control of the files and folders. I had to do this because some security settings will cause a failure copying files. Especially ones in application data and local settings.
start /wait subinacl.exe /errorlog=”C:\errorlog.txt” /nostatistic /subdirectories F: /[email protected] /grant=Everyone=F /objectexclude=*.swp /objectexclude=*.dmp
/objectexclude=*.tmp /objectexclude=pagefile.sys /objectexclude=hiberfil.sys
-
start /wait subinacl .exe //this starts the script and waits for it to complete before moving to the next line in the batch file
-
/errorlog=”C:\errorlog.txt” //this saves an error log to the path specified
-
/nostatistic //this suppresses displaying the progress
-
/subdirectories //Makes it do all files and subdirectories in the path specified
-
F: //Path to hard drive
-
/[email protected] //Who takes ownership of the files
-
/grant=Everyone=F //Grant Everyone Full Permissions
-
/objectexclude=*.tmp // no need wasting time on a file we aren’t going to copy.
Line 2 Will robocopy the entire contents of the harddrive expect: *.swp *.dmp *.tmp pagefile.sys hiberfil.sys MCAF*.TMP “$VAULT$.AVG” “_RESTORE” “MSOCache” “Recycled” “RECYCLER” “Temporary Internet Files” “System Volume Information” “WUTemp”
I don’t copy those files because I have never run into a time when I needed anything in any the folders and it just wastes time to copy them.
start /wait robocopy.exe F:\ T:\test /E /ZB /COPY:DAT /IA:RASHNTCEO /X /V /FP /XF *.swp *.dmp *.tmp pagefile.sys hiberfil.sys /XD MCAF*.TMP “$VAULT$.AVG” “_RESTORE” “MSOCache” “Recycled” “RECYCLER” “Temporary Internet Files” “System Volume Information” “WUTemp” /R:1 /W:0 /LOG:”C:\Documents and Settings\Yan\Desktop\robolog.txt” /TEE
-
start /wait robocopy .exe //this starts the script and waits for it to complete before moving to the next line in the batch file
-
F:\ //Source
-
T:\test //Destination
So now just double click robocopy.cmd on your desktop and away it goes…
Categories: