1833758 Members
2333 Online
110063 Solutions
New Discussion

find command

 
SOLVED
Go to solution
Ragni Singh
Super Advisor

find command

Hi guys,

how do I use the find command to find everything in a directory not containing a *.gz file. Any help will be greatly appreciated.
7 REPLIES 7
Paula J Frazer-Campbell
Honored Contributor

Re: find command

Hi

ls -l | grep -v "*.gz" | more

Should do it.

Paula
If you can spell SysAdmin then you is one - anon
James A. Donovan
Honored Contributor
Solution

Re: find command

that's easy...cd to the directory in question and...

$ find . ! -name "*.gz"
Remember, wherever you go, there you are...
Ragni Singh
Super Advisor

Re: find command

I need to run the find command to do this from the root directory on down. ls -l will just work on one dir. Thanks for your time.
Paula J Frazer-Campbell
Honored Contributor

Re: find command

Hi

ls -lR | grep -v "*.gz | more


will work for all dirs from root.

Paula
If you can spell SysAdmin then you is one - anon
Paula J Frazer-Campbell
Honored Contributor

Re: find command

Hi
Ooops miss the second quote :-


ls -lR | grep -v "*.gz" | more


will work for all dirs from root.

Paula
If you can spell SysAdmin then you is one - anon
Christopher McCray_1
Honored Contributor

Re: find command

Try this:

# find . \! -name *.gz -exec ls {} \;

just substute any other type of output command other than ls (lp,etc) for your results
Hope this helps

Chris
It wasn't me!!!!
Kevin Wright
Honored Contributor

Re: find command

find / ! -name "*.gz"

you can then use -exec to take action on what it finds..or | xargs rm
find / ! -name "*.gz" -exec rm {} \;