Hello again,
On Unix/Linux operating system, sometimes we need to get a directory structures with tree style-like without tree command.
Based on my story (doh!), my HD media player was embedded with Linux operating system and a single 2 GB SATA harddisk drive, busybox for main program utilities. A friend asked my media collections, and I want to give her all collection lists with tree style-like on a text file.
Unfortunately, on busybox there is not a tree program. So, I googled to looking for a solution and I found some useful commands using find, ls, grep and sed.
Here I taken from centerkey.com:
ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'
Above command is good enough, but that command produces just only directory lists, and I need all directories and all files.
So I modified that command and using find and sed command:
find . -print | sed -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'
Yes, that's right! All directories and files is printed properly.
Regards,
#janglapuk

0 komentar:
Posting Komentar