I need help.....
In my .bashrc file, I have a VERY useful function (it can be a little rough and ready-made and a little hacked, but it works with pleasure!), Which reads the input file and uses the "tree" function on each of the input lines to create a directory tree . this tree is then printed to the output file (along with the folder size).
multitree() { while read cheese do pushd . > /dev/null pushd $cheese > /dev/null echo -e "$cheese \n\n" >> ~/Desktop/$2.txt tree -idf . >> ~/Desktop/$2.txt echo -e "\n\n\n" >> ~/Desktop/$2.txt du -sh --si >> ~/Desktop/$2.txt echo -e "\n\n\n\n\n\n\n" >> ~/Desktop/$2.txt popd > /dev/null done < $1 cat ~/done }
This is a temporary splash screen, like the end, and displays the snippet as follows:
./foo ./foo/bar ./foo/bar/1 ./foo/bar/1/2
etc. etc.
however, the first (and most tedious) thing I need to do is delete all entries, leaving only the deepest path to the folder (using the above example, it will be reduced only to. / foo / bar / 1/2)
Is there a way to process the file before / after the tree function only to print the deepest levels?
I know something like python can do better, but my problem is that I never used python. And I'm not sure that working systems will let me run python ... they let us change our own .bashrc I'm not too worried!
Thanks in advance guys !!!!
Owen.
source share