+ Post New Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 16
How do you do....it? Thread, Robocopy Help in Technical; I'm trying to backup the entire C drive to an external USB drive using Robocopy, what would the correct syntax ...
  1. #1

    Join Date
    May 2008
    Posts
    14
    Thank Post
    9
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Robocopy Help

    I'm trying to backup the entire C drive to an external USB drive using Robocopy, what would the correct syntax be:

    robocopy "C:\*.*" "D:\BackupFolder" /E /V /NP /ZB /R:10 /W:30

    doesn't seem to be working.

  2. #2
    Quackers's Avatar
    Join Date
    Jan 2006
    Posts
    1,276
    Thank Post
    39
    Thanked 134 Times in 110 Posts
    Rep Power
    51
    Robocopy "C:\" "D:\BackupFolder" /MIR

    should do it, but add your timeouts to it.

  3. Thanks to Quackers from:

    soze (2nd June 2008)

  4. #3

    Michael's Avatar
    Join Date
    Dec 2005
    Location
    Birmingham
    Posts
    8,941
    Thank Post
    232
    Thanked 1,510 Times in 1,206 Posts
    Rep Power
    328
    Quackers is right, that should work. Here's a good reference of all command switches.

    As far as I can it's the "C:\*.*" which is incorrect.

  5. #4

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,144
    Thank Post
    113
    Thanked 518 Times in 447 Posts
    Blog Entries
    2
    Rep Power
    121
    Michael's right about the "*.*" being the problem - robocopy copies all files in the folder; you can't use it to (say) copy just the *.doc files.

    What you can do is exclude some files - /XF *.bak *.tmp will exclude .bak and .tmp files

    May not matter for what you're doing but I always include /sec to copy the security on files.

  6. Thanks to srochford from:

    soze (2nd June 2008)

  7. #5

    Join Date
    May 2008
    Posts
    14
    Thank Post
    9
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Thumbs up Creating Auto Run to work with Robocopy

    Thanks for the quick response guys, removed the *.* and the quotes and everything worked.

    Would any of you be familiar with the Auto Run command, I would like for this Robocopy string to be executed when a external USB drive is inserted into the machine with no user interaction.

    Thanks for all the Help!

  8. #6

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,390
    Thank Post
    797
    Thanked 1,588 Times in 1,391 Posts
    Blog Entries
    10
    Rep Power
    427
    For anyone who isn't the best with the commands this might help

    Utility Spotlight: Robocopy GUI

  9. Thanks to FN-GM from:

    soze (2nd June 2008)

  10. #7

    Michael's Avatar
    Join Date
    Dec 2005
    Location
    Birmingham
    Posts
    8,941
    Thank Post
    232
    Thanked 1,510 Times in 1,206 Posts
    Rep Power
    328
    I don't think Robocopy can be automated as far as that, but the easiest method would be to create a batch file and schedule it to run at 6pm for example, by which time you or someone would of plugged in a USB drive.

    Alternatively, you could just create a shortcut on your desktop and double click it once the USB drive has been connected.

  11. #8

    Join Date
    May 2008
    Posts
    14
    Thank Post
    9
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Quote Originally Posted by Michael View Post
    I don't think Robocopy can be automated as far as that, but the easiest method would be to create a batch file and schedule it to run at 6pm for example, by which time you or someone would of plugged in a USB drive.

    Alternatively, you could just create a shortcut on your desktop and double click it once the USB drive has been connected.


    I wish it could be that easy, it has to be automatic; no user interaction other then plugging in the USB drive.

    Thanks for the suggestion.

  12. #9

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,390
    Thank Post
    797
    Thanked 1,588 Times in 1,391 Posts
    Blog Entries
    10
    Rep Power
    427
    I wonder if you could make a VBS script that works in the background. Say drive letter “G” is occupied it will copy the contents to a folder.

  13. #10

    Michael's Avatar
    Join Date
    Dec 2005
    Location
    Birmingham
    Posts
    8,941
    Thank Post
    232
    Thanked 1,510 Times in 1,206 Posts
    Rep Power
    328
    I wonder if you could make a VBS script that works in the background. Say drive letter “G” is occupied it will copy the contents to a folder.
    That would make sense. Not sure how difficult a script it would be though!

  14. #11

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,390
    Thank Post
    797
    Thanked 1,588 Times in 1,391 Posts
    Blog Entries
    10
    Rep Power
    427
    It would be tricky, but i can give it a bash.

  15. #12
    ajbritton's Avatar
    Join Date
    Jul 2005
    Location
    Wandsworth
    Posts
    1,632
    Thank Post
    23
    Thanked 75 Times in 45 Posts
    Rep Power
    33
    Quote Originally Posted by srochford View Post
    Michael's right about the "*.*" being the problem - robocopy copies all files in the folder; you can't use it to (say) copy just the *.doc files.
    You can, but the syntax is along the lines of

    robocopy (SourceDir) (DestinationDir) (FileSpec)

    e.g.

    robocopy C:\ D:\ *.doc

  16. Thanks to ajbritton from:

    soze (2nd June 2008)

  17. #13
    ajbritton's Avatar
    Join Date
    Jul 2005
    Location
    Wandsworth
    Posts
    1,632
    Thank Post
    23
    Thanked 75 Times in 45 Posts
    Rep Power
    33
    Attached is a zip file containing a hastily cobbled together AutoIt script and INI file that will watch for the arrival of a particular drive letter. When detected, a simple directory copy (with forced overwrite) will take place and the script then waits for the drive to disappear before returning to its original wait mode. It's had very limited testing but seems to work OK.
    Attached Files Attached Files

  18. Thanks to ajbritton from:

    soze (2nd June 2008)

  19. #14

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,144
    Thank Post
    113
    Thanked 518 Times in 447 Posts
    Blog Entries
    2
    Rep Power
    121
    another alternative is to use WMI. This can set up somethng called an event sink which sits there waiting for an event to happen. When it does, you carry out a particular action.

    The attached script will do just that. run it (best to use wscript because otherwise you'll see a window on screen) and it will sit in the background waiting.

    When a USB stick is inserted, the sink event will trigger. I wrote this for something else (question here about how to check for "bad" files on a USB stick) but it's easy to adapt. Basically, when the USB device arrives it gets given a DEVICEID; this is used to find out more info about the drive including its name (not C: etc but things like harddisk0). This is then queried using WMI to get a list of partitions (USB sticks often have more than one partition)

    finally, the routine CheckFolder is called once for each partition - it's called with the drive letter and a backslash - eg G:\

    In that routine you could add something like:

    Code:
    Set oShell=createobject("wscript.shell")
    sCmd="robocopy " & sFolder & " c:\backup /s /e"
    oShell.run sCmd,7,true
    This will copy the contents of the partition to c:\backup - you can obviously put it where you want!
    Attached Files Attached Files

  20. Thanks to srochford from:

    soze (2nd June 2008)

  21. #15

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,390
    Thank Post
    797
    Thanked 1,588 Times in 1,391 Posts
    Blog Entries
    10
    Rep Power
    427
    Nice one, when "thanks" work again i will give you one for that.

  22. Thanks to FN-GM from:

    soze (2nd June 2008)

SHARE:
+ Post New Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Robocopy
    By acrobson in forum How do you do....it?
    Replies: 16
    Last Post: 22nd December 2007, 01:41 PM
  2. Robocopy question
    By switchflare in forum How do you do....it?
    Replies: 3
    Last Post: 18th October 2007, 07:25 PM
  3. Robocopy Gone Wrong
    By fawkers in forum Windows
    Replies: 2
    Last Post: 17th September 2007, 06:50 AM
  4. RoboCopy users.
    By tosca925 in forum Windows
    Replies: 3
    Last Post: 20th May 2007, 11:58 AM
  5. Robocopy questions...............!
    By Kyle in forum Windows
    Replies: 3
    Last Post: 28th January 2006, 07:20 PM

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
  •