Creativebits.org

an All Creative World site
Ivan's picture

Save a directory list to a file

terminal iconIf for whatever reason you need a list of files within a certain directory in text format you can do so using the ls Terminal command.

Just open Terminal, navigate to the required directory and then enter one of these commands to save the information to the directory.txt file:

Only the files within the directory: ls > directory.txt
Lists all subdirectories recursively: ls -R > directory.txt
Sorts by time of last modification: ls -t > directory.txt

For more options check this page.

Commenting on this Blog entry is closed.

morse's picture
69 pencils

thank you

jozefk's picture
251 pencils

# man ls

pesonaly I like to use it as # ls -BgGh
but for list of files in text format I like # ls -m > textfilename.txt

and the # stat command is nice one because you can get more control of the output. like a format for example.
just an example:
# stat --format="--NAME: %n
> --ACCESS: %x
> --MODIFY: %y
> " * > textfilename.txt

There is a manual page for stat command as well: # man stat

KNOPPIX.net
FROM ZERO TO LINUX IN 5 MINUTES

steveballmer's picture
627 pencils

Back to the terminal people!
LOL
You people crack me up!

http://stevefakeballmer.wordpress.com/
I am not Steve Ballmer pretending not to be me!

shumaker212's picture
1 pencil

I use Print directory to print the directory listing to a file..

Find Here : http://www.print-directory.com

jozefk's picture
251 pencils

Is that working with Unix Operating Systems?

KNOPPIX.net
FROM ZERO TO LINUX IN 5 MINUTES

Creativebits is a blog about creativity, design and Macs. We also have a critique section where you can post your work to get opinions and a forum to discuss any design related topics.

Recommend us on Google

Latest critique

Do you need a great new logo?

If you need a logo for your company or product you can get it done with us.
In our logo store you can pick from over 28,000 pre-made logos that will be customized to your name for free or you can post a contest for us for just $250 and our designers from all over the world will submit dozens of logo design suggestions to your specific needs.

Marketplace