The Haiku/BeOS Tip Server
Tips and tricks for Haiku/BeOS users

Text files from directory listings

Contributed by: Scot Hacker
This tip is valid for: Both BeOS and Haiku

From time to time, you may find it useful to have a text record of a particular directory listing. For instance, you may need to mail a list of all the JPEGs in a project folder, or you may need to send documentation of what’s going on on your hard drive to a software vendor. This is something that Tracker can’t do, but it’s easy with bash (Terminal).

Fine-tune your listing until you’ve got it right, then just use “>” to redirect the output, then specify a path and filename. For example:

ls -l -R *.jpg > /boot/home/Desktop/jpegs.txt

This will look down recursively from the current directory, creating a detailed listing of files ending with the .jpg extension, then spit the results to a file called jpegs.txt on your desktop.

Posted in Terminal


(comments are closed).