I want to cp
a file to another directory but that directory doesn't exist yet.
So I would do:
mkdir /new_place
cp the_file /new_place
Can I do this in one?
I imagine something like cp the_file -m /new_place
if "m" stood for "make dir's that don't exist"
Would this be a chance to use scp, rsync or another copying utility?
Best Answer
With
--parents
you can recreate the directories from the source to the destination. For example:Will create the subdirectories
~/Desktop/home/desgua/Downloads
and then copytest.txt
into it; andwill create
~/Desktop/Downloads
.