Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Jun 152011

Auto create complete directory structure when copying files in Linux


Assume you are copying file using the command below:

# cp foo/bar/test.txt /tmp/

The result is test.txt will be placed inside the folder /tmp/.

In order to let the cp command auto create the foo/bar/ directory structure under /tmp, you can try the command:

# cp --parent foo/bar/test.txt /tmp/

 Leave a Reply



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>