nigelr99
asked on
XCOPY failure on 'My Documents' folder on Windows 7
Hi,
I use a batch file to backup a user's files from a laptop hard drive (c:) to a mapped drive (z:) on a desktop pc . The desktop is running Windows XP but this particular laptop has Windows 7. I've never had a problem until using this Win7 laptop.
The batch file attached copies 2 folders but it fails on the second xcopy command with 'file not found - *.*'. The only conclusion I've arrived at after trying endless combinations / variations on the command is that Windows 7 doesn't like the folder name 'my documents' with a space in it as other folders copy fine. It also seems to work fine when entered directly at a dos prompt?
(I also noticed some seemingly intermittent problems copying files across manually using dos and drag/drop in explorer, with Windows hanging for long periods. I disabled the windows 7 feature called remote differential compression which may have solved that issue.)
Any ideas please on how to solve this seemingly trivial task?
Thanks.
I use a batch file to backup a user's files from a laptop hard drive (c:) to a mapped drive (z:) on a desktop pc . The desktop is running Windows XP but this particular laptop has Windows 7. I've never had a problem until using this Win7 laptop.
The batch file attached copies 2 folders but it fails on the second xcopy command with 'file not found - *.*'. The only conclusion I've arrived at after trying endless combinations / variations on the command is that Windows 7 doesn't like the folder name 'my documents' with a space in it as other folders copy fine. It also seems to work fine when entered directly at a dos prompt?
(I also noticed some seemingly intermittent problems copying files across manually using dos and drag/drop in explorer, with Windows hanging for long periods. I disabled the windows 7 feature called remote differential compression which may have solved that issue.)
Any ideas please on how to solve this seemingly trivial task?
Thanks.
echo ----------
echo Backing up Local Desktop..
echo .
c:
cd "\users\BDM\desktop"
z:
cd "\BDM\desktop"
xcopy c:*.* /d/s/y
echo ----------
echo Backing up Local Documents..
echo .
c:
cd "\users\BDM\my documents"
z:
cd "\BDM\my documents"
xcopy c:*.* /d/s/y
try xcopy "c:*.*" /d/s/y
soooo ... Z: is your mapped network location?
Try:
xcopy "c:\full path\to desktop\folder" "z:\users\BDM\desktop" /options
xcopy "c:\full path\to docs\folder" "z:\users\BDM\my docs" /options
It looks like you're trying to copy your full c: drive
The error might come from your in use files there (ie page file)
Try:
xcopy "c:\full path\to desktop\folder" "z:\users\BDM\desktop" /options
xcopy "c:\full path\to docs\folder" "z:\users\BDM\my docs" /options
It looks like you're trying to copy your full c: drive
The error might come from your in use files there (ie page file)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I've already tried "c:*.*" to no avail.
I'm only copying a particular folder on the c drive as I've changed directory previous to the xcopy command as follows:
c:
cd "\users\BDM\my documents"
If there was a file open, would this give the 'file not found' error? When first tested there was only one file in the 'my documents' folder so pretty sure this wasn't an issue.
I'm only copying a particular folder on the c drive as I've changed directory previous to the xcopy command as follows:
c:
cd "\users\BDM\my documents"
If there was a file open, would this give the 'file not found' error? When first tested there was only one file in the 'my documents' folder so pretty sure this wasn't an issue.
xcopy "C:\users\BDM\my documents\*.*" "z:\users\BDM\my documents" /d/s/y
Further clarification:
Do it like this:
Do it like this:
echo ----------
echo Backing up Local Desktop..
echo .
c:
cd "\users\BDM\desktop"
z:
cd "\BDM\desktop"
xcopy c:*.* /d/s/y
echo ----------
echo Backing up Local Documents..
echo .
c:
cd "\users\BDM\documents"
z:
cd "\BDM\documents"
xcopy c:*.* /d/s/y
What happens if there is not a single file according to the /d condition in any directory addressed?
MaSTeRiTo,
Using C:*.* will copy the current folder, using C:\*.* will copy the entire drive. The key is the backslash (\) afer the colon (:).
nigelr99,
What MaSTeRiTo said should almost work for you. One thing to note is that the actual folder name for your user docs is "Documents", not "My Documents". Or more specifically, use this:
Using C:*.* will copy the current folder, using C:\*.* will copy the entire drive. The key is the backslash (\) afer the colon (:).
nigelr99,
What MaSTeRiTo said should almost work for you. One thing to note is that the actual folder name for your user docs is "Documents", not "My Documents". Or more specifically, use this:
echo ----------
echo Backing up Local Desktop..
echo .
xcopy "c:\users\BDM\Desktop" "z:\BDM\Desktop" /d/s/y
echo ----------
echo Backing up Local Documents..
echo .
xcopy "c:\users\BDM\Documents" "z:\BDM\my documents" /d/s/y
I tested the above script on my WIndows 7 machine and it worked perfectly.
The same solution should be used for Vista also!
ASKER
Just checked the Win7 machine and path is definitely c:\users\BDM\my documents. I've attached a screen-shot just to make sure I'm not going mad.
I tried xcopy "c:\users\BDM\My Documents" "z:\BDM\my documents" /d/s/y
..but I get the same error.. something funny going on here right?
Update... I renamed the 'my documents' folder to 'documents' and script works fine.. sometimes you get to the stage when you don't care why any more!
win7-screenshot.PNG
I tried xcopy "c:\users\BDM\My Documents" "z:\BDM\my documents" /d/s/y
..but I get the same error.. something funny going on here right?
Update... I renamed the 'my documents' folder to 'documents' and script works fine.. sometimes you get to the stage when you don't care why any more!
win7-screenshot.PNG
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The penny's finally dropped.. different folder names in explorer and dos! I knew it would be something simple if not illogical.
Thanks ploftin and Comtek.. you've highlighted the problem so I'll share the points. Thanks!
Cheers.
Thanks ploftin and Comtek.. you've highlighted the problem so I'll share the points. Thanks!
Cheers.