Boat Drinks  

Go Back   Boat Drinks > General > Computer and Consoles

Reply
 
Thread Tools Display Modes
Old 01-05-2008, 01:25   #1
LeperousDust
Bananaman
 
LeperousDust's Avatar
 
Join Date: Jul 2006
Location: Liverpool/Edinburgh
Posts: 4,817
Default Windows cmd/batch monkeys (Robocopy and Del)

Right well i fully except the usual people to appear in this thread

Two problems: First i've got robocopy set up luuurvely and its mirroring happily see below:
Code:
robocopy.exe "D:\Documents" "E:\Backup\Documents" /S /ZB /COPYALL /LOG:E:\Backup\Documents.txt /DCOPY:T /R:10 /TEE
robocopy.exe "D:\Pictures" "E:\Backup\Pictures" /S /ZB /COPYALL /LOG:E:\Backup\Pictures.txt /DCOPY:T /R:10 /TEE
robocopy.exe "D:\Videos" "E:\Backup\Videos" /S /ZB /COPYALL /LOG:E:\Backup\Videos.txt /DCOPY:T /R:10 /TEE
robocopy.exe "D:\Music" "E:\Backup\Music" /S /ZB /COPYALL /LOG:E:\Backup\Music.txt /PURGE /DCOPY:T /R:10 /TEE
PAUSE
EXIT
I'm happy to have a carbon copy type process for my music as its a huge collection, but as you can see from the others, its more of an accumulation of files over time. What i'm kinda after is a way to make the documents robocopy process Incremental or Differential, is this feasible?

Second problem:
I want to make my downloads folder temporary, so files with certain attributes date/size/type etc... are deleted, and/or moved, but i have no idea where to start properly with if statement regarding attributes in batch files....

A lot of this is over my head! Googling is drawing blanks annoyingly so a little nudge in the right direction would be appreciated
__________________
LeperousDust is offline   Reply With Quote
Old 01-05-2008, 03:56   #2
Mark
Screaming Orgasm
 
Join Date: Jul 2006
Location: Newbury
Posts: 15,194
Default

OK - for the first one, robocopy should be (sort of) incremental (i.e. only copy the files that have changed) - unless you tell it not to be. There is, however, a caveat to this - and that is if the copy is between two different filesystem types.

This problem arises because different filesystems have different 'granularity' in the way they store file times. For example, NTFS is accurate to milliseconds, but FAT is accurate to two seconds. Robocopy doesn't account for this by default, but adding the /FFT switch may help with that. Looks like I need this switch too so this research has been useful for me.

PS - you could have also considered using the /M switch here, but that relies on well-behaved applications, and some of them aren't well-behaved (guilty ).

As for the second, I don't think you can do that with an IF statement, but maybe robocopy to the rescue here - look at combining the /MOVE and /MINAGE options, for example.
Mark is offline   Reply With Quote
Old 01-05-2008, 08:50   #3
Burble
Rocket Fuel
 
Burble's Avatar
 
Join Date: Jul 2006
Posts: 7,826
Default

Quote:
Originally Posted by Mark View Post
/MINAGE
I sniggered for a few seconds before noticing the 'A' there.
Burble is offline   Reply With Quote
Old 01-05-2008, 09:36   #4
Fayshun
Rocket Fuel
 
Fayshun's Avatar
 
Join Date: Jun 2006
Location: Adrift in the Orca
Posts: 6,845
Default

Quote:
Originally Posted by Burble View Post
I sniggered for a few seconds before noticing the 'A' there.
Child.

(joins in with the sniggering)
__________________

We must move forward not backward, upwards not forward, and always twirling, twirling, twirling...
Fayshun is offline   Reply With Quote
Old 01-05-2008, 10:36   #5
Mark
Screaming Orgasm
 
Join Date: Jul 2006
Location: Newbury
Posts: 15,194
Default

Quote:
ERROR : Invalid Parameter #1 : "/MINGE"
Sorry.
Mark is offline   Reply With Quote
Old 01-05-2008, 12:33   #6
LeperousDust
Bananaman
 
LeperousDust's Avatar
 
Join Date: Jul 2006
Location: Liverpool/Edinburgh
Posts: 4,817
Default

Get this filth out of here

The problem with robocopy is it write to the same destination file all the time, so although it writes a differential backup, i'm still left with only one backup copy. How can i write a script to say every x times its run write over the main folder again and delete the two extras, and every other time make a new folder and copy in there...

Robocopy for my download folder is possibly genius actually i hadn't thought of that, move them all to one folder and erase that instead, i'll look into that...
__________________
LeperousDust is offline   Reply With Quote
Old 01-05-2008, 12:41   #7
Mark
Screaming Orgasm
 
Join Date: Jul 2006
Location: Newbury
Posts: 15,194
Default

Ah, those.

You'll need two scripts - one to do the main backups and one for the incrementals. Use /MAXAGE or /A (not /M) on the incrementals and delete them in the main backup script (after completing the backup).

Another trick you can do with smaller backups (not the media library) is to robocopy the main backup to another backup (backup2) before updating the main backup. This gives you some history a bit like Apple's Time Machine. You can do this ad infinitum (backup3/4/5/6...) for as much disk space (or patience) as you have.
Mark is offline   Reply With Quote
Old 01-05-2008, 12:57   #8
LeperousDust
Bananaman
 
LeperousDust's Avatar
 
Join Date: Jul 2006
Location: Liverpool/Edinburgh
Posts: 4,817
Default

Right so let me get this straight (as so far my head is pretty fudged with robocopy scripts ).

I need a main backup script which rewrites the primary backup folders ever x times.
Another script which makes a new folder (called "one" we'll say) how does this compare source with destination and then write only the changed files into "one"?
Then i need another backup script that covers the two drives before, etc... yeah? I can't see in my head how i can do this, becuase roboycopy compares source with destination right?

I'm having more luck with the tempory folder though
__________________
LeperousDust is offline   Reply With Quote
Old 01-05-2008, 13:31   #9
Mark
Screaming Orgasm
 
Join Date: Jul 2006
Location: Newbury
Posts: 15,194
Default

OK - the easiest way to do this with robocopy as follows...

Script One...

The backup script as you have it now (does the main backup). However, at the end of the script, for each backed up folder, you need to add:

attrib -a <foldername> /s

And then delete the incremental backup directory ("one").

Script Two...

The original backup script as you had it (i.e. without the attrib commands), but change the destination directory of each robocopy (so it goes in "one") and add the /A option on the end.

This does rely on progams being good and setting the archive bit, which most do but some may not. YMMV - experiment with it.


The other option is use of /MAXAGE to catch any files modified within the last 'x' days (x being a number that is at least the interval between full backups - and adding an extra day may not be a bad idea). To do this, you don't need the attrib changes from step 1, and you should replace /A with /MAXAGE:x in step 2. This avoids 'broken' software forgetting to set the attribute bit. It may backup a few more files than you need, however.

Last edited by Mark; 01-05-2008 at 13:35.
Mark is offline   Reply With Quote
Old 01-05-2008, 13:42   #10
LeperousDust
Bananaman
 
LeperousDust's Avatar
 
Join Date: Jul 2006
Location: Liverpool/Edinburgh
Posts: 4,817
Default

Ahhh i see where you're going now I looked at max age, but i don't backup to a scehdule, its a removable drive and the contents don't change that often on this laptop to workout a schedule really, i just plug in as and when... So basically some software may mess up the archive bit i'm leaving behind on some of my documents depending on how the software was written... As i though this is turning out a little more complicated than first though Not too sure if its worth the hassle of probably not working properly, i'm not sure how much i will gain from being able to see back the last 3-5 copies of a file... I don't change all that much...

Thanks a load for the help though Mark I've got my temr download script working as it should i think just a little more testing but its there!
__________________
LeperousDust is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 15:46.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.