1

When using Window's command copy, i'm unable to find a way to force the destination-path to be created.

In the following example (assume that the source destination isn't created which is drive D:/

EXAMPLE

copy "D:\_steam\common\Counter-Strike Global Offensive\csgo\cfg\autoexec.cfg" "D:\_material\Counter-Strike Global Offensive/autoexec.cfg"

due to the fact that the destination-path isn't created (error):

user@pc $ "D:\_steam\common\Counter-Strike Global Offensive\csgo\cfg\autoexec.cfg" "D:\_material\Counter-Strike Global Offensive/autoexec.cfg" The system cannot find the path specified. 0 file(s) copied.

QUICK-FIX

Go ahead and manually create the destination path for the file to be copied over to. But this isn't a viable solution.

FINAL THOUGHTS

I'm looking for a way (only possibility, since it's a command, is a parameter) that allows the destination-path to be created.

Hopefully it'll be possible to have this be done via 1-line of code

REFERENCE

take a look at parameter /D here (doesn't work in my case): http://ss64.com/nt/copy.html

0

1 Answer 1

0

There is no straightforward way using "copy". You can use xcopy or construct a batch file that accepts source and destination, then tests for the destination, creates the destination if it doesn't exist, then copies the file.

1
  • I was hoping that this all could be done with just 1-line of code rather than having to construct a batch file
    – fohrums
    Commented Dec 20, 2015 at 5:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .