1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Create a batch file for MY SCANS to and external hard drive

Discussion in 'DOS/Other' started by Swazza, May 5, 2010.

Thread Status:
Not open for further replies.
Advertisement
  1. Swazza

    Swazza Thread Starter

    Joined:
    May 5, 2010
    Messages:
    8
    Hi,

    I am wanting to create a backup (.bat file) for "MY SCAN" which is located in "my document" under "documents" in "Libraries" to back up daily to my external hard drive which is F:/. I am using Windows 7. I have no clue how to do this as I know nothing about DOS. HELP????:confused:

    Thanks Jane
     
  2. Squashman

    Squashman Trusted Advisor

    Joined:
    Apr 4, 2003
    Messages:
    19,786
    Does this have to be done with a batch file?
    Plenty of software out there that can do this just fine.
    If you want to do this with a batch file then you should look at using the XCOPY or RoboCopy commands.
     
  3. Swazza

    Swazza Thread Starter

    Joined:
    May 5, 2010
    Messages:
    8
    No it doesnt have to be done with a batch file but really dont want to spend heaps (preferably none) on software. Any suggestions?
     
  4. TheOutcaste

    TheOutcaste

    Joined:
    Aug 7, 2007
    Messages:
    9,028
    This will copy everything from the My Scan folder in the currently logged on user's Documents folder to the external drive into a folder named My Scan in a folder named using the currently logged on user's User Name.
    You can double click to run, or open a command prompt and run it by name. If you type anything after the file name, it will list what will be copied, but won't copy anything.

    For example, save it to C:\Scripts as MyScanBack.cmd
    Open a command prompt, type C:\Scripts\MyScanBack to backup, type C:\Scripts\MyScanBack -list to list what will be copied.
    Or create shortcuts using either command as the file to run.
    Copy the text in the following code block into Notepad and save it someplace handy with a .cmd extension, like MyScanBack.cmd.
    Be sure to change the Save as Type: box to All Files when saving.
    Code:
    @Echo Off
    If "%~1"=="" (Set _List=) Else Set _List=/L
    Set _Sw=/E /R:2 /W:10 %_List%
    Robocopy "%userprofie%\Documents\My Scan" "F:\%Username%\My Scan" %_Sw%
     
  5. Squashman

    Squashman Trusted Advisor

    Joined:
    Apr 4, 2003
    Messages:
    19,786
    I think if you searched the Internet you would easily find something.
     
  6. Swazza

    Swazza Thread Starter

    Joined:
    May 5, 2010
    Messages:
    8
    Awesome thanks. I will give it a go today and let you know how I went.

    Cheers
     
  7. Swazza

    Swazza Thread Starter

    Joined:
    May 5, 2010
    Messages:
    8
    The Outcaste: I tried the above code but no sucess it just wont copy.

    Squashman: what do I search for I am a beginner at this an dont have any clue.
     
  8. TheOutcaste

    TheOutcaste

    Joined:
    Aug 7, 2007
    Messages:
    9,028
    What is the specific error that you get?
    Run it from a Command Prompt so you can see the errors. If needed delete the @Echo Off line to show each line as it executes.
    The above code assumes it located at C:\Users\<username>\Documents\My Scans
    One thought that comes to mind, since Vista/Win7 has done away with most of the "My " Folder structure, is the My Scans folder really named My Scans, or is it just Scans?
    In the Library, right click the folder, click Open folder location. In the right pane, double click the folder to open it. Then click in the address bar to switch the "breadcrumb" display to the true path and make sure the folder name and path matches the batch file.
     
  9. Swazza

    Swazza Thread Starter

    Joined:
    May 5, 2010
    Messages:
    8
    Outcaste: I ran the command prompt and it came up with:

    Error 3 <0x00000003> Assessing Source Directory
    C:\ Users\User1%userprofile%\documents\myscans
    The system cannot find the path

    (Sorry for the crap typing)

    In library the path is:

    User1/My Documnets/ My Scans
     
  10. Squashman

    Squashman Trusted Advisor

    Joined:
    Apr 4, 2003
    Messages:
    19,786
    That should tell you something. You probably don't have the path set correctly in the batch file.
     
  11. Swazza

    Swazza Thread Starter

    Joined:
    May 5, 2010
    Messages:
    8
    What does that mean and how do I fix it? Please help me I really dont understand.
     
  12. Squashman

    Squashman Trusted Advisor

    Joined:
    Apr 4, 2003
    Messages:
    19,786
  13. Swazza

    Swazza Thread Starter

    Joined:
    May 5, 2010
    Messages:
    8
    Squashman: Maybe if If you could just write a code for me that backs up the whole my documents?
    When I click on my documents the path is C:\Users\User1\Documents\

    Thanks
     
  14. TheOutcaste

    TheOutcaste

    Joined:
    Aug 7, 2007
    Messages:
    9,028
    %userprofile% should expand to C:\Users\User1. Wouldn't expect to see C:\ Users\User1%userprofile%. I did notice a typo in the code though, it shows %userprofie% (missing letter L) -- it should be %userprofile%. Sorry about that:eek:
    All it takes is one misplaced space or double quote, or a missing letter to cause it not to work.

    For example, is it My Scans, with a space between My and Scans, or is there no space, myscans, as you show in the error message?
    Try this corrected code. Remove the space from My Scans if you need to:
    Code:
    @Echo Off
     If "%~1"=="" (Set _List=) Else Set _List=/L
     Set _Sw=/E /R:2 /W:10 %_List%
     Robocopy "%userprofile%\Documents\My Scans" "F:\%Username%\My Scans" %_Sw%
    You can copy what you see in the Command Prompt, that will save having to type it, and will make sure nothing gets missed.
    To copy the contents of the Command Prompt window:
    Right click in the Command Prompt Window, click Select All. This will highlight everything.
    Press Enter. This will copy it to the clipboard.
    Return to the browser and right click in the Reply window, then click Paste.
    Or left click in the reply window and press CTRL+V.

    To backup the entire Documents folder, it's pretty much the exact same code:
    Code:
    @Echo Off
    If "%~1"=="" (Set _List=) Else Set _List=/L
    Set _Sw=/E /R:2 /W:10 %_List%
    Robocopy "%userprofile%\Documents" "F:\%Username%\Documents" %_Sw%
    Thought I'd attach a couple of screen shots to illustrate the difference between the breadcrumb path and the real path that the Address Bar shows.
    These two screen shots are of the same folder. The first shows the Breadcrumbs view, with the Friendly name:
    Library->Documents->My Documents
    The second shows the real path after clicking in the address bar:
    C:\Users\TheOutcaste\Documents
     

    Attached Files:

  15. Swazza

    Swazza Thread Starter

    Joined:
    May 5, 2010
    Messages:
    8
    YIPEE!!!! Thanks so much it worked!
     
  16. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/921195

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice