Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: ROBOCOPY - Create Backup Script


18 Sep 2011   #119
Golden

Microsoft Community Contributor Award Recipient

Windows 7 Ult. x64 Windows 8.1 x64
 
 
ROBOCOPY - Create Backup Script

How to Create a Backup Script using ROBOCOPY Command


...


My System SpecsSystem Spec
31 Aug 2012   #120
Golden

Microsoft Community Contributor Award Recipient

Windows 7 Ult. x64 Windows 8.1 x64
 
 

Thanks NailIT! Welcome to SevenForums!


My System SpecsSystem Spec
21 Sep 2012   #121
Mooring10

Windows 7 64 bit Home
 
 

I just joined after finding your excellent discussion from a Google search. Thanks for all the good information. I'm just starting to set a backup strategy to an external USB drive. I first just copied the directories but I noticed that the dates on the directories changed to the current date and some of the file dates changed also--that will not work for me.

I used your most simple command line:
robocopy E:\Data1 G:\Backups\Data1 /e /mir /np /log:backup_log.txt

When I ran this with my direcotires and qiuckly checked the desintation, which was blank. created new directories with the current date--again not what I wanted.

2 Questions---

1 Is there a way to use Robocopy to preserve all the dates for all directories and all files?

2 Is there a way to select copies from the source by FILE CREATION DATE? (Secondarily, can you point me to a good reference to dates for files and directories--I have heard that there are three different dates, creation, last modified, and last accessed)

Thank you.
My System SpecsSystem Spec
25 Sep 2012   #122
Golden

Microsoft Community Contributor Award Recipient

Windows 7 Ult. x64 Windows 8.1 x64
 
 

Hi Mooring10,

Thanks for the feedback, and apologies for the delayed reply.

The modified date of the folder will always change to the date that the copy is performed, since the folder is newly created on the USB device. The modified date of the files, however, should not change. Can you please check:
- the date of the folder
- the date of the files

To be sure that the file attributes (incl. dates) are copied and preserved, add the /COPYALL option as shown below:

Code:
robocopy E:\Data1 G:\Backups\Data1 /e /mir /np /copyall /log:backup_log.txt
To select files based on date, you need to use the /MAXLAD or /MINLAD OPTIONS. Please type the following at a command prompt and refer to those under the file selection options:

Code:
robocopy /?
I found this articel that explains the different dates:
Quote:
All Windows file systems record the same three values:
  • Time/Date Created: When you create a new file or directory, this value is set and does not normally change (unless you deliberately change it). If you make a new copy of a file and save it to a different location, it is treated as a new file and a new creation time stamp is set. Moving a file or simply renaming it does not create a new file, and thus does not give the file a new creation time stamp. (Note: It is possible to end up with a file that has a modification time that's earlier than its creation time when you make a new copy of a file.)
  • Time/Date Modified: This is also called the Last Written date. Whenever the contents of the file are changed, or files are added to or deleted from a directory, this time stamp changes. Renaming the file doesn’t change the modification time stamp. Neither does opening the file without making any changes to it.
  • Time/Date Accessed: This is supposed to show the last time the file was accessed, but experience proves that opening and reading a file without making changes does not immediately change this time stamp in Windows XP (this is because of the variance in resolution time mentioned earlier).
Build Your Skills: Learn to manipulate file time stamps in Windows | TechRepublic

Regards,
Golden
My System SpecsSystem Spec
27 Sep 2012   #123
Mooring10

Windows 7 64 bit Home
 
 

Thanks for your reply.

I trie your suggestion and used this line:

robocopy "C:\Data 01" "P:\WD My Book ES\Backups\Data 01" /e /mir /np /copyall /log:backup_log.txt
pause

Note I think the command line is word wrapping on me.

It goes to the pause statement without copying any files?
My System SpecsSystem Spec
.


04 Oct 2012   #124
motherpeople

Windows 7 x64
 
 

Hello. Awesome tutorial. I don't know yet how I've missed this robocopy command all those years.

Nevertheless, I have two questions:

1 - Which version is the current version or robocopy?
2 - How do I know which version do I have?

Believe me, I know how to use google, but I'm giving up. Also, there are at least two hot-fixes:
A robocopy command updates DACLs incorrectly in Windows 7 or in Windows Server 2008 R2
"Robocopy /B" does not copy the security information such as ACL in Windows 7 and in Windows Server 2008 R2

But, since I don't know which version I have I can't say for sure if I should apply them.
My current system is Windows 7 x64 SP1 with the latest updates.

Thanks in advance, and thanks again for this thread.

PS: The only "Manual" I can find is a file called robocopy.pdf with the title "Robocopy.exe Robust File Copy Utility Version XP010"... As far as I know that product version in fairly outdated...
My System SpecsSystem Spec
04 Oct 2012   #125
Golden

Microsoft Community Contributor Award Recipient

Windows 7 Ult. x64 Windows 8.1 x64
 
 

Hi,

Thanks for the compliment.

In C:\Windows\System32, find and right-click on Robocopy, then click Properties. Under the Details tab, you will find the version of Robocopy.

Name:  capture.png
Views: 311
Size:  23.4 KB

Regards,
Golden


My System SpecsSystem Spec
04 Oct 2012   #126
motherpeople

Windows 7 x64
 
 

That was easy. Sorry, I've installed Windows 7 yesterday for the first time, hence my disorientation... hehe.

Well... I have the same version like you: 5.1.10.1027 but, shouldn't we have the 6.1.7601 bundled with Windows 7 (as Wikipedia says?) and if there is no 6.17601 version do you think I should apply those fixes?

UPDATE:

Ok, here is the thing: the latest version bundled with Windows 7 and vista is this one: 5.1.10.1027 (which is not the same version even when they share the same version number).

So I was thinking that there is no such a thing as version 6.1, and we have to correct wikipedia. But, reading here:

http://en.wikipedia.org/wiki/Talk%3A...XP027.21.21.21

There is a link to one of the hotfixes which, aparently, updates robocopy to a 6.1 version...
http://support.microsoft.com/kb/2639043/en-us

I cannot confirm all this, but makes sense to me now.

Still I dunno if I should apply the fix....
My System SpecsSystem Spec
04 Oct 2012   #127
Golden

Microsoft Community Contributor Award Recipient

Windows 7 Ult. x64 Windows 8.1 x64
 
 

I would only apply it if you need it.....setup a test run to see what happens.
My System SpecsSystem Spec
09 Oct 2012   #128
champ488

Windows 7 64bit
 
 
Backup Script

I am having an issue with backing up the c:\user\username folder.
Here is my script:
robocopy "C:\Users\VocWorks User" E:\Backup /MIR /E
pause

It will copy Desktop, Favorites, My Documents, My Music and My Pictures. If there is any other folder in that directory it will not copy it. I have attached pictures of the Main drive and the Backup drive. Also it will only copy to the root of the drive not into a Folder called Backup. Any help would be greatly appropriated.


Attached Thumbnails
ROBOCOPY - Create Backup Script-main.jpg   ROBOCOPY - Create Backup Script-backup.jpg  
My System SpecsSystem Spec
09 Oct 2012   #129
motherpeople

Windows 7 x64
 
 

@champ488: Just for curiosity, why are you using both "/MIR /E" ? The manual says that "/MIR" Mirrors a directory tree (equivalent to /e plus /purge). So why the combination?

About the latest update to 6.1: Robocopy is working beautiful for me even when the Owner flag is not copied or updated with any possible switch combination. So, I will not take a risk breaking what already works, I'll wait for a proper release.
My System SpecsSystem Spec
Comment

 ROBOCOPY - Create Backup Script




Tutorial Tools



Similar help and support threads for2: ROBOCOPY - Create Backup Script
Windows 7 Tutorial Category
Robocopy Backup - ERROR 5 (0x00000005) Backup and Restore
How to create batch script to lock workstation then log off. General Discussion
Robocopy backup for personal folders Backup and Restore
I Need Help To Create REG. Script With Admin. Priv. For Reg. Editor? Customization
Robocopy backup - file permissions General Discussion
Anyone use robocopy to backup? Backup and Restore
Create ErrorHandler.cmd script file General Discussion

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 07:31 AM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33