Hi everyone,
I have been a big fan here since a couple years (since I started being an admin ...) and finally decided to become a member and help ppl and perhaps being helped
Now I have a problem that might interest some of the gurus.
I am abig fan of what I call "one liners". I am trying to obtain a "tree view" kind of display with the name of the group that owns the folder. I got it except for folders with spaces
Here is the first part of my "code" arranged in a more "human readable maner:
auditpath="/path/audited"
auditoutput="/export/home/XX/server_path_audited.txt"
for I in `find $auditpath -type d | grep -v .snapshot`
do
tree=`echo $I | sed -e 's;[^/]*/;|____;g;s;____|; |;g'`
group=`ls -ld $I | awk '{print " "$4}'`
echo $tree" "$group
done
Output looks cool :o
| |____forlder foldergrp
| | |____subfolder subfolderg
| | | |____subfolder subfolderg
| | | |____subfolder subfolderg
But when it comes to folder with spaces it can't handle it :
| | | | | | |____subfolder subfolderg
| | | | | | | |____subfolder subfolderg
| | | | | | | |____subfolder subfolderg
| | | | | | | |____sub
folder
spaced
The actual folder is supposed to be "sub folder spaced" or whatever ...
I based my code on something I found somewhere (sorry, no originale credits )
find . -type d -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
Which handles spaces perfectly.
Any idea on the way I can handle this?
BTW this is Solaris 8 9 and 10
Big thanks to those who can take time to check this out.
Regards,
---
Spelling warning: English is NOT my primary langage