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/