Page 1 of 1

Help with the Linux ls command....

Posted: 2004-07-07 01:18am
by TrailerParkJawa
I don't know if this is possible but here is goes:

I want to run this command: ls -laR /
I'd like to search each directory at / except for one.
For example we have: /var
/etc
/tmp
/flash
/shares

I would like to get the output of the recursive search for every directory but /shares. Does anyone know if there is a way to exclude a directory?

Posted: 2004-07-07 01:28am
by Pu-239
Why is there a /shares? /flash normally is under /mnt

Anyway, try

Code: Select all

ls / |grep -v shares|xargs ls -laR
There may be a way to exclude stuff with one command, but this works.

There's also a third-party tree program.

Posted: 2004-07-07 01:40am
by TrailerParkJawa
There is /shares directory because this is a NAS box running a modified form of Linux. The /shares directory could have 0 files if it is fresh out of the box, or hundreds of thousands of files if it is a production server.

Thanks for the tip, I'll try that syntax and see if it works.