+ 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
    1,832
    Thank Post
    62
    Thanked 161 Times in 133 Posts
    Rep Power
    64

    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
    1,730
    Thank Post
    309
    Thanked 227 Times in 201 Posts
    Rep Power
    86

  3. #3

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,656
    Thank Post
    324
    Thanked 506 Times in 474 Posts
    Rep Power
    177
    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 02:26 PM.

  4. #4

    Join Date
    Apr 2010
    Posts
    1,832
    Thank Post
    62
    Thanked 161 Times in 133 Posts
    Rep Power
    64
    Cheers

  5. #5

    SpuffMonkey's Avatar
    Join Date
    Jul 2005
    Posts
    2,192
    Thank Post
    52
    Thanked 270 Times in 178 Posts
    Rep Power
    131
    Download Richcopy instead - same thing but with an easy to use GUI

  6. #6


    Join Date
    Feb 2007
    Location
    51.405546, -0.510212
    Posts
    8,120
    Thank Post
    203
    Thanked 2,385 Times in 1,765 Posts
    Rep Power
    703
    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
    1,832
    Thank Post
    62
    Thanked 161 Times in 133 Posts
    Rep Power
    64
    ACLs would be handy for work but RichCopy might be what I need for home.

  8. #8

    Join Date
    Apr 2010
    Posts
    1,832
    Thank Post
    62
    Thanked 161 Times in 133 Posts
    Rep Power
    64
    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,656
    Thank Post
    324
    Thanked 506 Times in 474 Posts
    Rep Power
    177
    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, 09:14 PM
  2. Please help me find the links.....................!
    By tosca925 in forum General Chat
    Replies: 6
    Last Post: 19th December 2005, 08:31 AM
  3. Help me get rid of some spyware please!!
    By StewartKnight in forum Windows
    Replies: 30
    Last Post: 10th October 2005, 11:30 PM
  4. Replies: 10
    Last Post: 27th September 2005, 09: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, 10: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
  •