Tuesday, 15 September 2015

bash - List all the subdirectories inside a folder and save it into a file -



bash - List all the subdirectories inside a folder and save it into a file -

in ubuntu scheme have directory named tree. can list subdirectories , files using

ls -r <filename>

command.

how save output text file?

one way be:

ls -r . >> myfile.txt

this append listing myfile.txt

another if want see output on console redirect file then:

ls -r . |tee -a myfile.txt

you utilize find command like:

find . -print >> myfile.txt

if want create new file, instead of ">>" utilize ">" in above command. while tee, remove -a option.

bash ubuntu

No comments:

Post a Comment