+ Post New Thread
Results 1 to 9 of 9
Scripts Thread, Help me create Robocopy syntax in Coding and Web Development; Hi, I am total useless at robocopy syntax. I always end up with multiply commands that all seem to do ...
  1. #1

    Join Date
    Apr 2010
    Posts
    2,169
    Thank Post
    111
    Thanked 192 Times in 159 Posts
    Rep Power
    85

    Help me create Robocopy syntax

    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

  2. #2

    fiza's Avatar
    Join Date
    Dec 2008
    Location
    London
    Posts
    2,372
    Thank Post
    477
    Thanked 339 Times in 287 Posts
    Rep Power
    158

  3. #3

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,824
    Thank Post
    372
    Thanked 544 Times in 507 Posts
    Rep Power
    184
    Quote Originally Posted by edutech4schools View Post
    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:

    Code:
    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:

    Code:
    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
    Last edited by Steve21; 7th May 2012 at 03:26 PM.

  4. #4

    Join Date
    Apr 2010
    Posts
    2,169
    Thank Post
    111
    Thanked 192 Times in 159 Posts
    Rep Power
    85
    Cheers

  5. #5

    SpuffMonkey's Avatar
    Join Date
    Jul 2005
    Posts
    2,268
    Thank Post
    55
    Thanked 285 Times in 191 Posts
    Rep Power
    136
    Download Richcopy instead - same thing but with an easy to use GUI

  6. #6


    Join Date
    Feb 2007
    Location
    51.403651, -0.515458
    Posts
    9,807
    Thank Post
    262
    Thanked 2,967 Times in 2,182 Posts
    Rep Power
    846
    The main problem with RichCopy is that it hasn't been updated since 2009 and still has quite a few bugs (like the one where ACLs aren't copied across).

  7. #7

    Join Date
    Apr 2010
    Posts
    2,169
    Thank Post
    111
    Thanked 192 Times in 159 Posts
    Rep Power
    85
    ACLs would be handy for work but RichCopy might be what I need for home.

  8. #8

    Join Date
    Apr 2010
    Posts
    2,169
    Thank Post
    111
    Thanked 192 Times in 159 Posts
    Rep Power
    85
    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?

  9. #9

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,824
    Thank Post
    372
    Thanked 544 Times in 507 Posts
    Rep Power
    184
    Quote Originally Posted by edutech4schools View Post
    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



SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 14
    Last Post: 18th March 2012, 10:14 PM
  2. Please help me find the links.....................!
    By tosca925 in forum General Chat
    Replies: 6
    Last Post: 19th December 2005, 09:31 AM
  3. Help me get rid of some spyware please!!
    By StewartKnight in forum Windows
    Replies: 30
    Last Post: 11th October 2005, 12:30 AM
  4. Replies: 10
    Last Post: 27th September 2005, 10:25 PM
  5. Help me find a driver for Ghost Cast Boot Disk
    By ninjabeaver in forum Hardware
    Replies: 6
    Last Post: 26th September 2005, 11:50 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •