Copy a file to a new directory path in DOS
Posted
by nodmonkey
on Super User
See other posts from Super User
or by nodmonkey
Published on 2010-03-12T17:07:11Z
Indexed on
2010/03/12
19:07 UTC
Read the original article
Hit count: 567
How can I copy a file using DOS commands into a directory structure that may not yet exist? I need to be able to force the creation of the directory path to the target file location if that location doesn't already exist.
For example, there is already a file.txt in this location:
C:\file.txt
And I want to copy it to
C:\example\new\path\to\copy\of\file\file.txt
but at this time
C:\example\
and all the subdirectories may or may not yet exist.
Basically, I am looking for a "copy and create the target path if necessary" command. What would you recommend is the best way to achieve this?
© Super User or respective owner