Robocopy script mirror from one computer to the next
I have been playing with robocopy for some time now. I have setup a simple program to mirror my flash drive to whatever computer I plug it into.
The problem is best explained by this example:
1. I run the program daily on a certain computer.
2. I also run this program every once in a while on different computers so these other computers don't have everything new all the time. When I run it on these other computers they backup the entire drive and not just what is new.
3. when I run this program again on the daily computer after running it some where else it again backs up everything regardless of whats on the computer that is the same as on the flash
so to sum it up when ever I change computers and backup it backs up everything, instead of just what is new from the last time I backed it up on that computer, and then when I go back to my PC i use regularly it backs up everything all over agian even though nothing has changed. :blink:
I beleive it has to be something with the arichive bit being reset...but I thought robocopy was looking at dates last modified / created not just an archive bit.
any help would be great!
here is the robocopy switches/parameters I am using and a sample of part of the program:
set source=%drivePath%
set dest=C:\%user%
set what= /COPYALL /B /MIR
:: /COPYALL COPY ALL file info
:: /B copy files in Backup mode.
:: /SEC copy files with SECurity
:: /MIR MIRror a directory tree
set options=/R:0 /W:0 /LOG:%drivePath%\logs\Robo-log.txt /NDL /NP /TEE /XO
:: /R:n number of Retries
:: /W:n Wait time between retries
:: /LOG Output log file
:: /NDL No dir logging so it doesn't show all directories (shows everything on the flash)
:: /NP No Progress – don’t display % copied.
:: /TEE display on screen while logging
:: /XO If destination has the same file as source with the same date or newer then nothing is copied from source to destination
echo ### Mirroring...
::robocopy command pulling variables from above
ROBOCOPY %source% %dest% %what% %options%
Re: Robocopy script mirror from one computer to the next
Can you tell us how is it running now? As a scheduled task? If so, put the scheduled task on hold, edit the script, then unhold the task. There is also a utility that does all the hard work for your and that is called RoboCopyPlus, simply download by searching it from google. It expands on 'native' ROBOCOPY, adding a few switches that let you email the results and logfile.
Re: Robocopy script mirror from one computer to the next
No this is not a scheduled task. I don't want to use another program since it would just be to many clicks.
all this is is a batch file running whenever I click on it to backup my flash to the computer since a flash isn't reliable but its portable
Can anyone tell me about the script and say why it would backup everything if I switch to a computer?
Re: Robocopy script mirror from one computer to the next
This may do your commandline. I am counting that you will not have spaces in your log file:
Code:
$prog = 'c:\script\robocopy'
$source = '\\global-data-server\global\work\KA'
$dest = 'c:\test'
$what = '/COPYALL /B /SEC /MIR'
$options = '/R:15 /W:53 /TBD /RH:0715-2359 /MOT:39'
$logg = '/LOG+:C:\temp\_katastrofe_dok2.log /NFL /NDL'
RunWait(@ComSpec & ' /c "' & $prog & '" "' & $source & '" "' & $dest & '" ' & $what & ' ' & $options & ' ' & $l