PDA

View Full Version : Robocopy, how to create dated directories every run?


Korialstrasza
03-04-2008, 06:47 PM
Hey guys,
is it possible to have robo copy create a new folder for the copies every time it runs?

Like:
C:\backups\3-1-08\
C:\backups\3-2-08\
C:\backups\3-3-08\
C:\backups\$date
etc.

instead of just overwriting the same directory over and over?

Thanks guys

unhappy_mage
03-04-2008, 07:56 PM
http://www.tech-recipes.com/computer_programming_tips956.html

This is astoundingly complicated for what it does, but that's batch files for you. I'd suggest making it do YYYYMMDD so that it sorts properly by name in Explorer - I can't think of any reason to sort by month before year.

Korialstrasza
03-04-2008, 10:07 PM
Excellent, worked great!

Now, what will happen when the HD I'm backing up to is full? Can I set some way to delete directories after x days or something?

Thanks.

Edit: think I found the answer, gotto make a batch file to delete the stuff that are older than x days and schedule it to run every so often. Pretty neat, there's a whole world of batch fun!

newdamage1
03-05-2008, 11:21 AM
http://www.tech-recipes.com/computer_programming_tips956.html

This is astoundingly complicated for what it does, but that's batch files for you. I'd suggest making it do YYYYMMDD so that it sorts properly by name in Explorer - I can't think of any reason to sort by month before year.

I dug around on the net yesterday for this exact thing, this is WAY simpler than the others I found, thanks!