1

I have a question about backing up files from the command line. We have a shared folder (stored on one of the computers) in the office containing several thousand files and subfolders. Until now, I've been doing (automatic) full backups every morning, but obviously this isn't the best way to do it because most of the files remain unchanged for many days. So, I've decided to take a different approach - backup only files created and files modified yesterday (yesterday because we assume the backup runs today in the morning) - and here's the problem.

I've looked at forfiles, xcopy and Robocopy - all of them seem to deal with "date modified" of files, but not with "date created". So, if, for example, a user created a file on his Desktop, say, a week ago, and copied it to the shared folder yesterday, this file won't be included in the backup, because, as you know, when a file is copied, it retains its "date modified" (in our case this would be a week ago) and changes its "date created" to the date it was copied on. In other words, I need the backup to search in the shared folder for files "created" yesterday. And the second problem: if a user created a file on his Desktop and MOVED (not copied) it to the shared folder yesterday, then both the "date created" and "date modified" will remain the same - and this file won't be included in the backup either. I've thought about either forcing Windows to somehow change both creation and modified dates of a file when it is copied/moved to this particular folder, to the current date (don't like this idea much though), or, something like telling Robocopy to create a file/folder list of everything in that shared folder and before doing the next backup, create a new list and compare it with the previous one - and if there are new files, add them to the backup. But no progress so far.

So, any (preferably native) solutions to the above would be much appreciated. All PCs in our office run Windows 7 Ultimate x64.

Many thanks in advance.

0

You don't need dates to mirror a folder using robocopy. You may use the /MIR switch.

An example command to mirror two directories using Robocopy:

Robocopy \\SourceServer\Share \\DestinationServer\Share /MIR /FFT /Z /W:5

Explanation of the switches used:

  • /MIR specifies that Robocopy should mirror the source directory and the destination directory. This will delete files at the destination if they were deleted at the source.
  • /FFT uses fat file timing instead of NTFS. This means the granularity is a bit less precise so as to not rely on the file timings to be completely precise to the second.
  • /Z ensures Robocopy can resume the transfer of a large file in mid-file instead of restarting.
  • /W:5 reduces the wait time between failures to 5 seconds instead of the 30 second default.
  • Thank you for your help. I forgot to mention that I'm not looking for ways to set up mirroring of the folder. What we'd prefer are seperate folders created daily (on every Robocopy run) containing only the files that were changed/added the previous day (including those that may get deleted later). I researched some more, and I think I'll go ahead with making use of the archive attribute (once cleared, it gets back on in case a file is modified, renamed or even moved) and the /M switch. – stoyian0v Jun 24 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.