TechSpot

xcopy help

By thewolfe
May 17, 2003
  1. 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
     
  2. Mictlantecuhtli

    Mictlantecuhtli TS Evangelist Posts: 4,345   +11

    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.
     
  3. Nic

    Nic TechSpot Paladin Posts: 1,549

    Try this ...

    @Echo off
    xcopy "F:\Doug's Stuff\test*.*" "F:\Doug's Stuff\fax\*.*" /v /d /y /k /h
     
  4. Justin

    Justin TS Rookie Posts: 942

    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.
     
  5. thewolfe

    thewolfe TS Rookie Topic Starter Posts: 238

    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
     
  6. Justin

    Justin TS Rookie Posts: 942

    /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
     
  7. thewolfe

    thewolfe TS Rookie Topic Starter Posts: 238

    That did it. Thanks.
     
  8. thewolfe

    thewolfe TS Rookie Topic Starter Posts: 238

    Another question.

    When should/could I use *.* as in
    "F:\Doug's Stuff\fax\*.*" /v /d /y /k /h
     
  9. LNCPapa

    LNCPapa TS Special Forces Posts: 4,210   +424

    When you want to act upon all FILES in a folder

    LNCPapa
     
  10. legally dead

    legally dead TS Rookie

    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
     
  11. kimsland

    kimsland Ex-TechSpotter Posts: 14,524

    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.
     
Topic Status:
Not open for further replies.

Similar Topics

Add New Comment

You need to be a member to leave a comment. Join thousands of tech enthusiasts and participate.
TechSpot Account You may also...