PWD and TREE dir structure dump restore
I have two questions.
(1) When i change to a soft linked directory, i actually land up in a new location, but PWD command still shows, not the exact folder location but the soft link source folder only. How to see the actula present working Directory. (2) I have a server, where i need to to take Dir Tree structure dump, only, as data is not of much important, but also, in time of scarctity, i will have to to immediately create all those dir struvcture as per the Tree command output. How would i be able to do it fast, as i have some thousand of (sub)(sub)(dir). Regards DEBU |
Hi.
1) Use '/bin/pwd' instead of 'pwd' to get the real pathname. 2) Have a look at the 'install' command, and 'mkdir -p'. install will copy a file, and create all the parent directories as needed, mkdir -p will do the same sort of thing, but with directories. Dave |
You could also do something like
# find /path/to/tree -type d > dirlist to get a list of the directories. Then # for dir in `cat dirlist`; do mkdir "$dir"; done to recreate them. Dave |
Quote:
will show the physical path. Quote:
$ cd new_target_directory $ (cd old_source_directory; find . -mindepth 1 -type d) | xargs -n 50 mkdir -- Reuti |
Thanks Dave and Reuti. The solution really helped me.
~Best Regrads Debu |
All times are GMT -5. The time now is 02:50 PM. |