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 mkdir 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.
mkdir -pcan save you the trouble of recreating all the parents; you only need to give it the deepest directories. (This is not part of most good ways of solving this specific problem, just a side note.)