Results 1 to 3 of 3
  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    XCopy Multiple File Extensions (XP)

    Is it possible to xcopy multiple file extensions with one line of code?

    As an example:
    xcopy "e:MyDirectory*.xls;*.doc" "Z:backup" /S /Y[tab 'Note two different types of file extensions.

    As opposed to:
    xcopy "e:MyDirectory*.xls" "Z:backup" /S /Y
    xcopy "e:MyDirectory*.doc" "Z:backup" /S /Y


    I have not had any success.
    Thanks,
    John

  2. #2
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: XCopy Multiple File Extensions (XP)

    The syntax of the XCOPY command (do XCOPY /?) shows that this is not possible. You have to make two XCOPY commands. You can just have one line in your BATch file by doing something like:

    for %%x in (xls doc) do xcopy "e:MyDirectory*.%%x" "Z:backup" /S /Y

    (and note that the double quotes aren't needed unless there's a blank somewhere in the path). You could have reduced the previous line to:

    for %%x in (xls doc) do xcopy e:MyDirectory*.%%x Z:backup /S /Y

    This just generates the two original lines of code when it is run, but reduces the size of the BATch file.

    John
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  3. #3
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: XCopy Multiple File Extensions (XP)

    Thank you

Posting Permissions

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