xcopy help

Status
Not open for further replies.

thewolfe

Posts: 237   +0
xcopy help

I want the following batch file to copy a file named "test" located on F: drive in the Doug's Stuff folder to the "Fax" folder on the same drive. What am I missing?

@Echo off
xcopy "F:\Doug's Stuff\test*.*" "F:\Doug's Stuff\fax*.*" /V /D /Y /S /K /H/
exit
 
You said Fax is a directory, but the command is to copy test*.* files to fax*.* to the same directory. In addition, there's an unneeded / in the end.
 
Try this ...

@Echo off
xcopy "F:\Doug's Stuff\test*.*" "F:\Doug's Stuff\fax\*.*" /v /d /y /k /h
 
You don't need an "echo off", you know, and it in fact is helpful to not use that in case one of the copies goes wrong.
 
Nic,

Your batch file worked so....I tried to copy a folder using the following and nothing happened. P.S. I do have a folder "dougs stuff" in the "Doug's Stuff" folder.

Also, if I add the /s switch to your original batch file, it won't work. Why is that?

@Echo off
xcopy "F:\Doug's Stuff\dougs stuff*.*" "F:\Doug's Stuff\fax\*.*" /v /d /y /k /h
 
/S copies all directories and subdirectories
You are specifilying a file, or a directory with wildcards. That is an invalid switch to use in that case. IF you wanted to copy all the directories and subdirectories, use /S but no wildcards for source or destination:

xcopy "F:\Doug's Stuff\dougs stuff" "F:\Doug's Stuff\fax" /v /d /y /k /h /e

try that instead
 
Another question.

When should/could I use *.* as in
"F:\Doug's Stuff\fax\*.*" /v /d /y /k /h
 
I am on WinXP. What is wrong with this batch file script. I tried it using local C folders and it works? When I try to use network folders it doesn't

%echo off

rem this batch file is
rem designed to copy
rem quick styles and
rem normal template and
rem quick access toolbar

xcopy "\\Server\templates\ATS templates\Normal\*.*" " C:\Documents and Settings\%user%\Application Data\Microsoft\Templates\" /e /y
xcopy "\\Server\templates\ATS templates\Quick Styles\*.*" " C:\Documents and Settings\%user%\Application Data\Microsoft\QuickStyles\" /e /y
xcopy "\\Server\templates\ATS templates\QAT\*.*" " C:\Documents and Settings\%user%\Application Data\Microsoft\Office\" /e /y

I am not sure %user% is correct. I want the files to be copied from the server folder to the users folder who is currently logged on. There are other folders under 'documents and settings' e.g. 'all users' 'default user' 'administrator' etc. Is there a way of restricting to the user currently logged on to the PC?

any help would be cool - legally dead xx
 
Yes there's %userprofile%

But seeming you're going to Application Data, you may as well just write %Appdata%

This thread is 5yrs old, I really think a new thread would have been preferred though.
 
Status
Not open for further replies.
Back