Results 1 to 20 of 20

Thread: Windows 7 XCOPY problem

  1. #1
    New Romantic
    Join Date
    Nov 2007
    Posts
    6,522

    Windows 7 XCOPY problem

    I'm trying to write a batch file that will perform incremental backups each night. The file looks like this:
    Code:
    xcopy "c:\Users\davalynn\My Documents" "Z:\Backups\davalynn backup\My Documents" /h /r /s /e /i /c /y /d
    xcopy "c:\Users\davalynn\AppData\Roaming\Thunderbird\Profiles\vdkm8ik1.default" "z:\Backups\davalynn backup\vdkm8ik1.default" /h /r /s /e /i /c /y /d
    xcopy "c:\Users\davalynn\Favorites" "z:\Backups\davalynn backup\Favorites" /h /r /s /e /i /c /y /d
    The last two XCOPY commands work fine. The first one, however, yields the following error:
    Access denied
    Unable to create directory - Z:\Backups\davalynn backup\My Documents
    File not found - *.*
    0 File(s) copied
    All the directories referenced in the batch file exist on the Z:\ drive - I created them myself. There must be a syntax problem somewhere, and I've been looking at it for so long I can't see it.

    Any suggestions (other than to use something other than XCOPY) would be greatly appreciated.

  2. #2
    New Romantic
    Join Date
    Oct 2002
    Location
    ORA-01013 user requested cancel of current operation
    Posts
    8,677
    Disclaimer: I'm only doing this because you specifically forbid it.

    Have you considered using deltacopy?

    P.S. The access denied message implies that the problem is permissions on a directory or files in the directory, as opposed to any issue with the directories existing. Is the batch file being run with administrator permissions?

  3. #3
    New Romantic
    Join Date
    Nov 2007
    Posts
    6,522
    So far I've been calling the batch file from the command prompt, which is open with admin permissions. I've been testing by just running the one line from the command prompt.

  4. #4
    New Romantic
    Join Date
    Oct 2002
    Location
    ORA-01013 user requested cancel of current operation
    Posts
    8,677
    So if you just copy that line from the batch file to your command prompt, you get the same permissions errors?

    I'm betting your local admin account must not have permissions to some aspect of that Z: mount. I'm not much of a windows security guru so I don't have good advice on how to diagnose exactly what, other than to just "cd Z:Backups\davalynn backup\My Documents" and see if there's any file it won't let you fiddle with.

  5. #5
    How To Go
    Join Date
    May 2006
    Location
    Merriam, KS
    Posts
    10,999

  6. #6
    New Romantic
    Join Date
    Jul 2005
    Location
    Calgary
    Posts
    9,976
    "My Documents" is probably a special case here because it's a junction point, not a directory. I'm not sure how xcopy is even supposed to handle them, but it's also possible that the destination can't handle it as well, if it's a network share or FAT32 drive or something.

  7. #7
    New Romantic
    Join Date
    Nov 2007
    Posts
    6,522
    I don't think I have a permissions problem - I can navigate to the Z drive just fine and create a folder using mkdir with no problem.

  8. #8
    New Romantic
    Join Date
    Nov 2007
    Posts
    6,522
    Quote Originally Posted by Fugitive View Post
    "My Documents" is probably a special case here because it's a junction point, not a directory.
    So it's an alias for something else? That's what I thought too, but if that were the case could I navigate to it at the command prompt?

  9. #9
    New Romantic
    Join Date
    Jul 2005
    Location
    Calgary
    Posts
    9,976
    A junction point basically makes the target directory accessible through a different point in the filesystem. You can navigate to it and do stuff in it just like a regular directory, but you're actually affecting the directory it points at. Xcopy doesn't seem to handle them very well, from what little information I've been able to find.

    As of Vista and Win7, \Users\whoever\My Documents is just a junction point that actually points to \Users\whoever\Documents, so you could back that up instead.

    Edit: Go to your user directory and do a "dir /ah" and it should show you all of the junction points there and what they're pointing at.

  10. #10
    New Romantic
    Join Date
    Jun 2005
    Location
    Los Angeles
    Posts
    8,014
    Robocopy?

  11. #11
    New Romantic
    Join Date
    Nov 2007
    Posts
    6,522
    Ding ding ding! I should have been pointing to Documents and not My Documents. Thanks, Fugitive!

  12. #12
    World's End Supernova Chris Nahr's Avatar
    Join Date
    Jun 2002
    Location
    Aurora
    Posts
    16,677
    Quote Originally Posted by Fugitive View Post
    As of Vista and Win7, \Users\whoever\My Documents is just a junction point that actually points to \Users\whoever\Documents, so you could back that up instead.
    I was very confused about this issue when I went from Vista to Windows 7. Suddenly the name of this folder had changed back from "Documents" to "My Documents"... with a junction also called "My Documents" pointing to the real "My Documents" folder in the same directory!

    Now I've looked a little closer and found that Windows 7 cheats: the actual folder is called "Documents" as in Vista, but it seems to have some special shell attribute so that when looking at the directory with Explorer or Speed Commander instead of the command prompt, the name of the "Documents" folder appears as "My Documents" -- same as the junction.

    And now I also found the responsible Speed Commander setting: "Show localized names for files & folders". Sounds like a misnomer to me -- "My Documents" is the shell folder version of "Documents", not the localized name. But whatever... at least now I'm seeing the actual folder names again. There does not appear to be an equivalent setting in Windows Explorer, though.

  13. #13
    New Romantic
    Join Date
    Jun 2002
    Location
    Stockholm
    Posts
    8,665

  14. #14
    Social Worker
    Join Date
    Jul 2002
    Location
    Fake Virginia Gamertag: Meursault
    Posts
    3,961
    Quote Originally Posted by Anders Hallin View Post
    Copy ][+ forever, man!

  15. #15
    Account closed How To Go
    Join Date
    May 2003
    Location
    Michigan, USA Gamertag: Talisker 18
    Posts
    12,345
    You should take Microsoft's SyncToy out for a spin -- a few mouse clicks and a scheduled task later, and you're done.

  16. #16
    New Romantic
    Join Date
    Apr 2003
    Location
    Delirium, Texas
    Posts
    9,746

  17. #17
    New Romantic
    Join Date
    Jul 2005
    Location
    Calgary
    Posts
    9,976
    Quote Originally Posted by Chris Nahr View Post
    And now I also found the responsible Speed Commander setting: "Show localized names for files & folders". Sounds like a misnomer to me -- "My Documents" is the shell folder version of "Documents", not the localized name. But whatever... at least now I'm seeing the actual folder names again. There does not appear to be an equivalent setting in Windows Explorer, though.
    They call it 'localized names' since that's where they now do the translation into different languages. The directory name in the filesystem remains "Documents" no matter which language edition of Windows it is, but the displayed name changes based on your language setting, and "My Documents" is the English localized version.

    Previous versions instead changed the actual directory names in the filesystem, but they can't do that anymore now that you can potentially have different languages for different users on the same system through the multilanguage packs. It's still a mess, but it at least starts to make some sense.

  18. #18
    World's End Supernova Chris Nahr's Avatar
    Join Date
    Jun 2002
    Location
    Aurora
    Posts
    16,677
    Oh, I see. That's actually pretty clever!

  19. #19
    How To Go
    Join Date
    May 2006
    Location
    Merriam, KS
    Posts
    10,999
    That's one way to force software developers to use the environment variables.

  20. #20
    World's End Supernova Chris Nahr's Avatar
    Join Date
    Jun 2002
    Location
    Aurora
    Posts
    16,677
    The Documents folder is represented by a Shell API function, not an environment variable. But developers are no longer forced to use that either, because they can now rely on the actual folder being called "Documents" across all installations. So... quite the opposite, really.

Posting Permissions

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