Xcopy error reading exclude file....

Discussion in 'Software' started by Ken3, Feb 4, 2005.

  1. Ken3

    Ken3 MajorGeek

    I'm pulling my teeth out trying to figure this out. At my work computer (W2K PRO), my profile is set up as a roaming user (in a Users group - no admin) and have a Network drive (H:) to back up my data. I have a batch file set up using XCOPY to back up .ZIP files located in My Documents excluding any from a particular folder. However, when running the batch file I get an error

    "Can't read file <filename>

    0 file(s) copied"



    The batch file, "Copy My Docs to H network.bat", is this ...

    @ECHO OFF
    REM [Xcopy .zip files from My Documents to H: excluding files from MIGDATA


    Pause


    xcopy "C:\Documents and Settings\username\My Documents\*.zip" "H:\My Documents\" /D/S/E/Y /EXCLUDE:"C:\Documents and Settings\username\My Documents\xCOPY_EXCLUDE.TXT"
    pause
    rem exit


    The exclude file, xCOPY_EXCLUDE.TXT, contains this ("username" contains periods "." in it as well) ....

    C:\Documents and Settings\username\My Documents\MIGDATA\



    This is my first attempt at using the /EXCLUDE: option. Does this option only work when xcopying all files some place or is something wrong with what I've got? Because my profile is in a User group (not admin) have any bearing on this?

    Just to let you know, in the exclude file I got the same error using w/o quotes "\migdata\" not using the full path. I've also tried the exclude option itself without the path and still get the error.

    Once this is working I'll be using the Task scheduler to perform the backups regularly. OBTW - can't use share/freeware. Have to use what I got on my 'puter.

    I'm at a lost here. I've googled and couldn't come up with anything.

    Thanks.....Ken
     
  2. Ken3

    Ken3 MajorGeek

    I played around with SUBST and %USERPROFILE% and got it to work! This is what the batch file looks like (need to cleanup to take the pauses out). I added a display redirection to see what files were backed up ....

    @ECHO OFF
    REM [Xcopy .zip files from My Documents to H: excluding files from MIGDATA

    Pause


    subst E: "%userprofile%\My Documents"
    subst
    pause

    xcopy E:\*.zip "H:\My Documents\" /D/S/E/Y/EXCLUDE:E:\MyDocs_EXCLUDE.TXT >>E:\Backup.log
    subst E: /D
    pause
    exit


    I did try it with setting a variable "MyDocs" to the Userprofile\My Documents path, wherever you see 'E:' but got the error again. Seems by using SUBST did the trick. Why? I don't know but wish I knew. Any takers on the reason?
     
  3. lcreed

    lcreed Private E-2

    Thanks for the help. I'll try your suggestions.
    Larry
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds