Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Tuesday, August 3, 2010 5:35 PM
Hi All,
I have a problem with using RoboCopy. I am using Windows 2008 server. I wrote a batch file for using Robocopy. I setup a schedule in Task Scheduler. My problems are:
1) In Task Scheduler, I setup "Stop task if it runs longer than 12 hours", I want to stop RoboCopy if it runs more than 12 hours. But it would not work. In Last Run Result field, it shows "The last run of the tak was terminated by the user", But RoboCopy didn't stop, I checked Task Manager, in Processes tag, I show RoboCopy was running.
2) For using Robocopy, I don't know why it shows Newer in my log file, acturall, these files didn't be changed. Any one know how RoboCopy work with TimeStamp. What time stamp Robocopy check. Is Created date, save date, modify date or some another date?
Thanks in addvice,
All replies (10)
Tuesday, August 3, 2010 7:09 PM ✅Answered
Issue 1 Solutions:
1) Use the robocopy RUN Hours (/RH:) option. That way it will only run during the hours specified in the command line....however the EXE will be resident in memory the whole time...checking the clock to know when it can run. This limits needing to terminate it.
2) Schedule taskkill /F /IM robocopy.exe to terminate the program instead.
Issue 2:
I believe it uses a combination of the last modified time stamp and size. If either changes then it is considered new. I know this is explained in the documentation for the version prior to being bundled winth 2008. See if you can find the download and documentation for that version.
Tuesday, August 3, 2010 7:18 PM
Read the section on Using Robocopy File Classes, you probably need to include or exclude one or more of the classes.
http://theether.net/download/Microsoft/Utilities/robocopy.pdf
Tuesday, August 3, 2010 8:06 PM
Hi LearnStudy, you could try RichCopy which is a free utility from Microsoft. It is based on Robocopy technology, but extends this further. It has a very easy user interface, and works extremely well. You can download the utility at the following location:
http://technet.microsoft.com/en-us/magazine/2009.04.utilityspotlight.aspx
Kind Regards.
Tuesday, August 3, 2010 8:44 PM
Thank you so much for your help.
Solution 1:
Q1: when I use Use the robocopy RUN Hours (/RH:) option. Do I need to schedule my batch file? or, I just run the batch file once, then let robocopy runs.
Q2: when I use Use the robocopy RUN Hours (/RH:) option. Do I need to use /MON:n and /MOT:m option?
Thanks a lot.
Tuesday, August 3, 2010 8:59 PM
Q1: when I use Use the robocopy RUN Hours (/RH:) option. Do I need to schedule my batch file? or, I just run the batch file once, then let robocopy runs.
Depends on what you are trying to do. If its just a one time over night thing, run the batch file once. If its a daily thing, schedule the batch file to be run at computer startup, so it restarts if the server is reboted, then run the task manually to get it going. You may need some other tasks that check if it stops as well.
Q2: when I use Use the robocopy RUN Hours (/RH:) option. Do I need to use /MON:n and /MOT:m option?
Is it required...NO. Do you need it? Depends. If changes at the source can occur after the initial copy but before the run hours have expired the MON and MOT options would catch those changes. Using RH with out those swtiches is usually just a one time only copy that will run between those hours. It is used to have a hard start/stop to prevent running into business hours or ther activities.
Wednesday, August 4, 2010 8:24 AM
If it is a one time copy, you do not need to schedule or use /mon (/mot). If you need to copy files regularly, you can create a shedule or use the switches.Shaon Shan| TechNet Subscriber Support in forum| If you have any feedback on our support, please contact [email protected]
Wednesday, August 4, 2010 4:04 PM
Hi All,
Thank you so much for your help. Your information is very useful for me.
My situation is that I the following command to sync files from my local NAS storage to branch office NAS storage via T1 line every night start at 6:00PM.
ROBOCOPY \Source \Destination /E /DCOPY:T /COPY:DAT /XA:SH /MIR /R:1 /W:1 /V /TS /FP /NP /LOG:MirrorLog.txt /TEE
It usually can completely before next day at 6:00AM. But since I update new firmwire for NAS device, Robocopy could not complete, becasue there are a lot of files shows Newer when I checked Log file. Newer means The source file has later time stamp than the destination file. The file is copied. I knew that the user didn't change exsiting files, they olny do is add new files. I don't know why it happenned. Is any body know why?
Now I want to do the following: would you please help me to reveiw it and see if it is ok? Thanks a lot.
1. Schedule Run Batch file – Robocopy everyday at 6:00PM.
2. Define RUN Hours From 6:00PM to 6:00AM in Robocopy. Just allow robocopy to copy files during this period.
ROBOCOPY \Source \Destination /E /DCOPY:T /COPY:DAT /XA:SH /MIR /R:1 /W:1 /RH:1800-0600 /V /TS /FP /NP /LOG:MirrorLog.txt /TEE
3. Schedule Run another batch file - taskkill /F /IM robocopy.exe to terminate the program.
Thanks a lot.
Wednesday, August 4, 2010 4:19 PM
Hi All,
I still have a question about Task Scheduler. I setup "Stop task if it runs longer than 12 hours", when I scheduled to run the bacth file inculding Robocopy command. In Last Run Result field, it shows "The last run of the tak was terminated by the user", But RoboCopy didn't stop, I checked Task Manager, in Processes tag, I show RoboCopy was running.
Q1: Can any one know how Task scheduler works for setup "Stop task if it runs longer than 12 hours"? What will be stop, batch file or program in the batch file? In my case, Robocopy did not stop. But it shows "The last run of the tak was terminated by the user". I dont know what would be terminated.
Thanks in advance.
Wednesday, August 4, 2010 6:38 PM
Q1: Can any one know how Task scheduler works for setup "Stop task if it runs longer than 12 hours"? What will be stop, batch file or program in the batch file? In my case, Robocopy did not stop. But it shows "The last run of the tak was terminated by the user". I dont know what would be terminated.
When you run a batch file (double click it) it open a CMD.exe, that CMD.exe runs the batch file that launches Robocopy.exe. Take that concept and apply it to the Task Scheduler, and you can assume that Task Scheduler only knows about the Batch/CMD process, not about any EXE that the batch file starts...like Robocopy.exe.
A simple End Task test would be to double click the batch file, then kill the CMD.exe process, to see if Robocopy would be killed as well. Killing CMD.exe via Task Manage and the End Process Tree option (any child processes started by the parent) will do it, but probably not just the End Process option. Odds are Schedule Tasks just kills the parent and not the child processes in this manner....you can verify that by verifying the CMD.exe parent process is killed.
Monday, August 9, 2010 5:16 PM
Hi, Thank you so much for your help.
I have another question about my robocopy issue.
I used the following command to sync files from my local NAS storage to branch office NAS storage via T1 line every night start at 6:00PM.
ROBOCOPY \Source \Destination /E /DCOPY:T /COPY:DAT /XA:SH /MIR /R:1 /W:1 /V /TS /FP /NP /LOG:MirrorLog.txt /TEE
But since I update new firmwire for Source NAS device, there are a lot of files shows Newer when I checked robocopy Log file. I checked some folders and files on Both Source and Destination, there are same time on modified Date.
Do you know why it shows Newer and copied files, when time and date on Source and Destination location are same? I thought that it should be showed same, and did not copy.
Thanks.