Sample Header Ad - 728x90

Is there a command to recreate directory trees?

9 votes
5 answers
1636 views
I created a 'cron' subdirectory in
/var/log/
. It is:
/var/log/cron
Within
/var/log/cron
I've created numerous sub-directories to store my log files for cron jobs. I am wondering if there is a way to output
to match the directory structure my automated jobs use. For example these sub-directory structure exists within
| ronshome
|-- personal_growth
|   |-- building_your_relationship
|   |-- fun_things_that_make_life_worth_living
|   |-- hope_is_found
|   |-- life_lessons
|   |-- thought_of_the_day
|   |-- what_makes_a_good_friend
|   |-- what_my_friends_mean_to_me
|   `-- who_am_i
My desired output is:
mkdir /var/log/cron/ronshome
mkdir /var/log/cron/ronshome/personal_growth
mkdir /var/log/cron/ronshome/personal_growth/building_your_relationship
mkdir /var/log/cron/ronshome/personal_growth/fun_things_that_make_life_worth_living
etc. Essentially if I need to do a server restore I would like to be able to use this to recreate the log directories.
Asked by Ron Piggott (205 rep)
Jun 7, 2025, 04:17 PM
Last activity: Jun 16, 2025, 10:21 AM