Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Similar command to linux tree command in adb shell

Tags:

linux

android

adb

I want to list all files and folders of music directory of android mobile. Where I am using

 ls -l -R /sdcard/music

It gives all files and folders but not in a proper way.

Any one tell me adb shell command that displays files and folders hierarchy of a directory like "tree" linux command.

like image 498
ghulam_ali Avatar asked Aug 02 '13 10:08

ghulam_ali


1 Answers

I don't know if you still looking for this, but I believe this command can help you (works on adb as well):

find . -print | sort | sed 's;[^/]*/;|---;g;s;---|; |;g'

It prints a directory tree (both folders and files) in a more readable way than

 ls -l -R

If you want just a folder tree, you can use this one:

ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/   /' -e 's/-/|/'
like image 102
charsta Avatar answered Nov 10 '22 04:11

charsta