find - finding files.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting find - finding files.
# 1  
Old 09-02-2002
find - finding files.

I understand that to find a type of file using command find I could do "find -type f -name \*.htm -print".

However, I wish to find all files BUT *.htm.

Can I negate the search somehow?

Again, I have peeked into the man files etc... If anyone has an answer, Thanks in Advance!
# 2  
Old 09-02-2002
try

find . -type f ! -name \*.htm -print

this will find any files but not *.htm

Note
make sure you in the right directory
the . (dot) will run the command from
current directory

Last edited by hassan2; 09-04-2002 at 04:11 PM..
# 3  
Old 09-04-2002
Hi.. Somehow it does not work for me..

oracle@CG_JDA1:/home/oracle/admin/ODBMSPRD/bdump_> ls -l
total 29584
-rw-r--r-- 1 oracle dba 85 Jun 05 21:09 afiedt.buf
-rw-r--r-- 1 oracle dba 2806703 Sep 04 13:12 alert_ODBMSPRD.log
-rw-r--r-- 1 oracle dba 11619859 Jun 08 15:52 alert_ODBMSPRD_arch01.log
-rw-r--r-- 1 oracle dba 28700 May 24 20:57 ay23alert
-rw-r--r-- 1 oracle dba 738 Aug 29 16:45 reco_106850_odbmsprd.trc
-rw-r--r-- 1 oracle dba 22387 Aug 28 06:44 reco_129284_odbmsprd.trc
-rw-r--r-- 1 oracle dba 8869 Aug 27 01:33 reco_133942_odbmsprd.trc
-rw-r--r-- 1 oracle dba 782 Aug 07 17:18 smon_100048_odbmsprd.trc
-rw-r--r-- 1 oracle dba 645 Jul 28 17:42 smon_111560_odbmsprd.trc
-rw-r--r-- 1 oracle dba 1056 Aug 25 13:32 smon_122782_odbmsprd.trc
-rw-r--r-- 1 oracle dba 464670 Aug 28 07:10 smon_126696_odbmsprd.trc
-rw-r--r-- 1 oracle dba 788 Jul 25 22:43 smon_129464_odbmsprd.trc
-rw-r--r-- 1 oracle dba 84767 Aug 27 01:57 smon_134590_odbmsprd.trc
-rw-r--r-- 1 oracle dba 691 Jul 24 09:11 smon_146742_odbmsprd.trc
-rw-r--r-- 1 oracle dba 737 Aug 29 14:20 smon_157314_odbmsprd.trc
-rw-r--r-- 1 oracle dba 920 Jul 31 18:27 smon_165126_odbmsprd.trc
-rw-r--r-- 1 oracle dba 644 Aug 14 15:53 smon_179512_odbmsprd.trc
-rw-r--r-- 1 oracle dba 614 Aug 21 06:18 smon_27820_odbmsprd.trc
-rw-r--r-- 1 oracle dba 754 Jul 26 16:01 smon_71350_odbmsprd.trc
oracle@CG_JDA1:/home/oracle/admin/ODBMSPRD/bdump_> find . -type f! *.trc -print
find: 0652-009 There is a missing conjunction
oracle@CG_JDA1:/home/oracle/admin/ODBMSPRD/bdump_> find . -type f ! -name *.trc -print
find: 0652-009 There is a missing conjunction
oracle@CG_JDA1:/home/oracle/admin/ODBMSPRD/bdump_> set -o vi
oracle@CG_JDA1:/home/oracle/admin/ODBMSPRD/bdump_> find . -type f! -name *.trc -print
find: 0652-009 There is a missing conjunction
oracle@CG_JDA1:/home/oracle/admin/ODBMSPRD/bdump_> find . -type f ! -name *.log -print
find: 0652-009 There is a missing conjunction
oracle@CG_JDA1:/home/oracle/admin/ODBMSPRD/bdump_>

Thanks, ST2000
# 4  
Old 09-04-2002
You need to put a backslash before the asterisk.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find not finding stuff if run remotely

Hello I'm working on script to find tomcat on all my servers. Then find out what version of tomcat is installed. Basically I want to check and see if the latest version is installed. I'm testing the script on Solaris 10. I'm also going to need it to work on RHEL and SLES. If I run the following... (7 Replies)
Discussion started by: bitlord
7 Replies

2. Shell Programming and Scripting

Finding files and sorting by date (find | awk)

I am wanting to search a directory tree and return files that are older than a specified datetime. So far straight forward with find, now I want to sort in date order and format the output. So far I have this, but is not working and there is a problem with "." in the file and/or path names. ... (2 Replies)
Discussion started by: larry2311
2 Replies

3. Shell Programming and Scripting

Finding files with wc -l results = 1 then moving the files to another folder

Hi guys can you please help me with a script to find files with one row/1 line of content then move the file to another directory my script below runs but nothing happens to the files....Alternatively Ca I get a script to find the *.csv files with "wc -1" results = 1 then create a list of those... (5 Replies)
Discussion started by: Dj Moi
5 Replies

4. Shell Programming and Scripting

Finding older files using find command

Hi All, I want to find files which are older than 15 days. I have written a command as below, find -mtime +15 -print I understand (System date - last modified time of a file) should be greater than or equal to 15 days. This command returns files which are 15 days old.. i.e... (1 Reply)
Discussion started by: nshan
1 Replies

5. Shell Programming and Scripting

finding multiple files using find command

I am trying to search for 2 files using the find command as below find -name file1.txt -a -name file2.txt It doesn't give a result although the files exist in the folder, however when i try the following find -name file1.txt -o -name file2.txt It does give me the result. ./file2.txt... (4 Replies)
Discussion started by: vivek_damodaran
4 Replies

6. Shell Programming and Scripting

Important finding --- find files greater than 1 MB

as we can find file greater than 1 MB with find command as: find /dir -name '*' -size +1M find /dir/* -name '*' -size +1M but wats its doing is , its finding files only in current directory not in sub-directories. i want files from sub-directories too. Please help... Thanx in... (3 Replies)
Discussion started by: manoj_dahiya22
3 Replies

7. Shell Programming and Scripting

stop unix find on a directory structure after finding 1st occurrence

Hi, Has anyone tried to restrict Solaris 10 unix find on a large directory structure based on time to stop running after finding the first occurrence of a matching query. Basically I'm trying to build up a usage map of user workspaces based on file modification (week/month/3 months/year etc) and... (3 Replies)
Discussion started by: jm0221
3 Replies

8. Shell Programming and Scripting

finding duplicate files by size and finding pattern matching and its count

Hi, I have a challenging task,in which i have to find the duplicate files by its name and size,then i need to take anyone of the file.Then i need to open the file and find for more than one pattern and count of that pattern. Note:These are the samples of two files,but i can have more... (2 Replies)
Discussion started by: jerome Sukumar
2 Replies

9. Shell Programming and Scripting

how to find capital letter names in a file without finding words at start of sentence

Hi, I want to be able to list all the names in a file which begin with a capital letter, but I don't want it to list words that begin a new sentence. Is there any way round this? Thanks for your help. (1 Reply)
Discussion started by: kev269
1 Replies

10. UNIX Desktop Questions & Answers

How to find no of occurances Finding average time?

Hi, I have MyLog.log file, and it contains "*** response Time 150", I want to develop Unix script like , 1. extract all such occurances in the MyLog.log file and 2. compute the average time taken I am new to Unix, any one can give any idea/sample code for this? Thanks in advance. (1 Reply)
Discussion started by: redlotus72
1 Replies
Login or Register to Ask a Question