+ Reply to Thread
Results 1 to 3 of 3

Thread: copy folders from unstable locations using robocopy

  1. #1

    copy folders from unstable locations using robocopy

    This script will display an explorer select dialogue that allows you to select the source folder and a destination folder.
    The robocopy command will copy all files, regardless of path depth (yes, beyong 260 char limit), and will wait 999999 times with a wait period of 60 sec.

    Code:
    set "psCommand=powershell -Command "(new-object -COM 'Shell.Application')^
    .BrowseForFolder(0,'Please choose a folder.',0,17).self.path""
    for /f "usebackq delims=" %%s in (`%psCommand%`) do set "SrcDrv=%%s"
    if "%SrcDrv:~3,1%"=="" (set SrcDrv=%SrcDrv:~0,-1%)
    
    set "psCommand=powershell -Command "(new-object -COM 'Shell.Application')^
    .BrowseForFolder(0,'Please choose a folder.',0,17).self.path""
    for /f "usebackq delims=" %%d in (`%psCommand%`) do set "DestDrv=%%d"
    if "%DestDrv:~3,1%"=="" (set DestDrv=%DestDrv:~0,-1%)
    
    ROBOCOPY "%SrcDrv%" "%DestDrv%" /MIR /Z /R:999999 /W:60 /MT:8 /XD "$RECYCLE.BIN" "RECYCLER" "System Volume Information"
    pause

    I created this one for a problem my collegues ran into. We needed to recover some files from faulty drives that worked for 1 minute or two and then disconnected itself. Trying different SATA, USB to SATA adapters, nothing worked. So this would copy, hdd would disconnect, script would wait, hdd would reconnect, script would copy where it left off, and again.... and again... . I saved the department aprox. 2 days of work using this one. But no gratitude (as usual).
    Reply With QuoteReply With Quote
    Thanks

  2. Who Said Thanks:

    cloud99 (19.05.17) , takomania (31.12.16) , alpacino (30.12.16) , anon (30.12.16) , Bunny (30.12.16) , Codec (29.12.16)

  3. #2

    Join Date
    18.12.07
    Location
    .:under your bed:.
    Posts
    296
    Activity Longevity
    0/20 20/20
    Today Posts
    0/5 ssssss296
    Quote Originally Posted by Master Razor View Post
    But no gratitude (as usual).
    well, take some from me! i've experienced a similar problem in the workplace and wasted a lot of time as a direct result! i've taken a copy of this and i'm keeping it in my toolbox for future usage!

    Many thanks for this contribution, Master Razor! It's definitely appreciated by me!
    Reply With QuoteReply With Quote
    Thanks

  4. #3
    Moderator anon's Avatar
    Join Date
    01.02.08
    Posts
    39,439
    Activity Longevity
    8/20 19/20
    Today Posts
    1/5 ssss39439


    At the end of the day, the true reward is you knowing you did a good job and saved the situation. Anything else is just a bonus
    "I just remembered something that happened a long time ago."
    Reply With QuoteReply With Quote
    Thanks

  5. Who Said Thanks:

    cloud99 (19.05.17) , Master Razor (31.12.16)

+ Reply to Thread

Tags for this Thread

Posting Permissions

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