1833757 Members
2920 Online
110063 Solutions
New Discussion

listing files

 
SOLVED
Go to solution
Roberto Gallis
Regular Advisor

listing files

Hi all,
I have to list files of a directory and its subdirectories that are not equal to a certain extension
for example I have to list all files not equal to .doc
what kind of expressio should I use with the command find?

Roberto
5 REPLIES 5
Patrick Wallek
Honored Contributor

Re: listing files

ll | grep -v ".doc" will list all files that do NOT have a '.doc' in them somewhere.
Patrick Wallek
Honored Contributor

Re: listing files

Forgot one option on the ll

Do this to list current directory and all subdirectories for files without '.doc'

ll -R | grep -v ".doc"
Andreas Voss
Honored Contributor
Solution

Re: listing files

Hi,

you could use the find command ie:

find . ! -name '*.doc'

or in conjunction with ls:

find . -type f ! -name '*.doc' -exec ls -n {} \;

Regards
Roberto Gallis
Regular Advisor

Re: listing files

Thank you all!

regards

Roberto

Re: listing files

You can use :-

find "path_of_parent_directory" -type f \( ! -name '*.doc' \)