Article 56SJE [SOLVED] copy and create parent dirs

[SOLVED] copy and create parent dirs

by
ychaouche
from LinuxQuestions.org on (#56SJE)
Dear LQ,

Say you want to copy /usr/share/zoneinfo inside of another directory (a jail, for context, but that's irrelevant), say /var/www/clients/client1/web5/, but you want to create all the parents of zoneinfo inside that destination directory, so you'd end up having the contents inside /var/www/clients/client1/web5/usr/share/zoneinfo, all the parent directories have to be created.

Is there a way to achieve this in one command ? (cp or rsync with some options maybe ?)

I know you can always do a mkdir -p /var/www/clients/client1/web5/usr/share/zoneinfo beforehand but I was just curious to know if this can be achieved otherwise by a relevant copy commandlatest?d=yIl2AUoC8zA latest?i=Gw0mKlILGdE:rBOzrhRV5r4:F7zBnMy latest?i=Gw0mKlILGdE:rBOzrhRV5r4:V_sGLiP latest?d=qj6IDK7rITs latest?i=Gw0mKlILGdE:rBOzrhRV5r4:gIN9vFwGw0mKlILGdE
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments