PDA

View Full Version : Listing filenames



achuth
March 8th, 2012, 05:06 PM
I want to fetch every file names starting from root.
For that I think I can use a recursive listing.
But I want to avoid a single directory from being scanned. How can I do that?
I don't want that directory and the contents of that directory to be listed.

r-senior
March 8th, 2012, 05:13 PM
Use find with -prune? For example:


find . -path ./Documents -prune -o -print

See the manual page for find and look at the -prune and -o options:


man find

ofnuts
March 8th, 2012, 05:18 PM
I want to fetch every file names starting from root.
For that I think I can use a recursive listing.
But I want to avoid a single directory from being scanned. How can I do that?
I don't want that directory and the contents of that directory to be listed.


find / ! \( -path "*/pr0n" -o -path "*/pr0n/*" \)