none
XCopy - Force (F)ile or (D)irectory by default RRS feed

Answers

  • From XCOPY /? help ...

     /I           If destination does not exist and copying more than one file,
                  assumes that destination must be a directory.

    Also, placing a terminal backslash on the destination string does the same thing (implied in  the desktop (F1) help for XCOPY) ...

    • Specifying whether Destination is a file or directory

      If Destination does not contain an existing directory and does not end with a backslash (\), the following message appears:

      Does destination specify a file name
      or directory name on the target
      (F = file, D = directory)?

      Press F if you want the file or files to be copied to a file. Press D if you want the file or files to be copied to a directory.

      You can suppress this message by using the /i command-line option, which causes xcopy to assume that the destination is a directory if the source is more than one file or a directory.

    Forcing a FILE or directory can be done by ECHOING the F into xcopy through a pipe ...

      ECHO F|xcopy ...

    This is not case sensitive.


    Tom Lavedas
    • Edited by Tom LavedasModerator Friday, February 11, 2011 6:32 PM add the ECHO part
    • Marked as answer by IamMred Saturday, February 12, 2011 3:00 AM
    Friday, February 11, 2011 6:29 PM
    Moderator

All replies

  • From XCOPY /? help ...

     /I           If destination does not exist and copying more than one file,
                  assumes that destination must be a directory.

    Also, placing a terminal backslash on the destination string does the same thing (implied in  the desktop (F1) help for XCOPY) ...

    • Specifying whether Destination is a file or directory

      If Destination does not contain an existing directory and does not end with a backslash (\), the following message appears:

      Does destination specify a file name
      or directory name on the target
      (F = file, D = directory)?

      Press F if you want the file or files to be copied to a file. Press D if you want the file or files to be copied to a directory.

      You can suppress this message by using the /i command-line option, which causes xcopy to assume that the destination is a directory if the source is more than one file or a directory.

    Forcing a FILE or directory can be done by ECHOING the F into xcopy through a pipe ...

      ECHO F|xcopy ...

    This is not case sensitive.


    Tom Lavedas
    • Edited by Tom LavedasModerator Friday, February 11, 2011 6:32 PM add the ECHO part
    • Marked as answer by IamMred Saturday, February 12, 2011 3:00 AM
    Friday, February 11, 2011 6:29 PM
    Moderator
  • Thank you for your response.

     

    I used the "echo f|xcopy..." method and it works great!

     

    Much appreciated.

     

    --OSXniCKels

    Tuesday, February 15, 2011 2:01 PM
  • here is the proof that you not always need the source (e.g. linux); who whats everything ideal?! there is always a workaround!! ;)
    Wednesday, April 24, 2013 12:57 PM
  • This is such an inelegant solution, but works.

    So thanks Tom, and no thanks DOS

    Thursday, June 5, 2014 10:45 AM
  • This question has nothing to do with DOS. DOS is a 16-bit operating system that has nothing to do with xcopy.


    -- Bill Stewart [Bill_Stewart]

    Thursday, June 5, 2014 1:42 PM
    Moderator
  • There is no cross-platform way. Use copy instead of xcopy.

    Independent SharePoint Developer, freelancer http://blog.sharepoint-develop.com/

    Tuesday, January 26, 2016 2:15 PM
  • Old but good answer.

    Thanks

    Joe

    Tuesday, March 6, 2018 3:46 PM