Jump to content

Recommended Posts

Posted

Hi,

 

I am total useless at robocopy syntax. I always end up with multiply commands that all seem to do the same thing. I do have the list of switches but would like some help.

 

What I simply need is to copy the contents from one folder to another without it wiping the destination first and just to copy any new or updated files and log any problems.

 

should I use the /mir or something else?

 

Thanks

Posted (edited)
Hi,

 

I am total useless at robocopy syntax. I always end up with multiply commands that all seem to do the same thing. I do have the list of switches but would like some help.

 

What I simply need is to copy the contents from one folder to another without it wiping the destination first and just to copy any new or updated files and log any problems.

 

should I use the /mir or something else?

 

Thanks

 

Mir will delete it all if it's not there anymore. So generally better not to use it (imo).

 

This is one of my personal ones I use on my nas:

 

robocopy C:\ "\\MYNAS\StevePC\%date:/=-% C Backup" /M /S /R:2 /W:2 /XJ /B /XF *thumbs.db* *ntuser.dat* "C:\pagefile.sys" "C:\hiberfil.sys" /XD "$RECYCLE.BIN"

 

Obviously can remove the bits you don't want, but:

 

/M removes archive bits, aka makes it incremental so only copies things that change

/S copy subfolders too

/R:2 retries on fails

/W:2 wait seconds between retries

/XJ ignores junction points (aka if you had a shortcut to another drive, it won't go off and copy that drive too

/B use backup mode for files that normally you can't access

/XD/XF exclude files/folders you don't want copied

 

-Edit noticed you said logging too:

 

/LOG:filename <- makes log

/TEE shows log in command prompt and output (but don't need that really)

/NDL ignores directorys in terms of logging, else it'll spam you all then time

 

Edit 2 - My whole one:

 

robocopy C:\ "\\MYNAS\StevePC\%date:/=-% C Backup" /LOG:"\\MYNAS\StevePC\%date:/=-% C Backup\Log.txt" /TEE /NDL /M /S /R:0 /W:2 /XJ /B /XF *thumbs.db* *ntuser.dat* "C:\pagefile.sys" "C:\hiberfil.sys" /XD "$RECYCLE.BIN" "System Volume Information" "ProgramData" "C:\Windows" "C:\Program Files" "C:\Program Files (x86)" *Temporary* "C:\Boot" "C:\Users\Steve\Appdata"

 

Steve

Edited by Steve21
Posted
Mir will delete it all if it's not there anymore. So generally better not to use it (imo)

 

Is that not what you would want? If I delete a folder on the source it will delete it on the destination. or have I missed your point?

Posted
Is that not what you would want? If I delete a folder on the source it will delete it on the destination. or have I missed your point?

 

It depends if you want to backup items or just copy e.g. If a student deletes a file and you're using /Mir you just lost your backup

 

So really depends on what you want to do with it?

 

Steve

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...