Quantcast
A Graphics.com 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.

morse's picture
52 pencils

thank you

jozefk's picture
169 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

--
programmer's editor
www.vim.org

steveballmer's picture
221 pencils

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

http://fakesteveballmer.blogspot.com
I am not Steve Ballmer pretending not to be me!

Latest critique

  • Snowmobile Poster ver 2
  • Snowmobile Poster

On Demand Videos


On Demand Videos: Video tutorials for graphic designers providing tools and information you can trust — and use — on your very next project. Subscribe today!

Marketplace