Computing.Net > Forums > Unix > To find files with different ending

To find files with different ending

Reply to Message Icon

Original Message
Name: Jenny_2007
Date: October 17, 2007 at 04:43:20 Pacific
Subject: To find files with different ending
OS: Unix
CPU/Ram: Unix
Model/Manufacturer: Unix
Comment:

Hi!
I just wonder if anyone can help me. I'm trying to write a shell script, but don't know where to begin exactly.
I need to write a script that will go into each directory, even subdirectories and check for a file that ands with ".txt" and ".pdf" at the same time.

I know I can use

find . -name '*.txt' –print
find . -name '*.pdf' –print

but how can I write a script that will search for both at the same time.

Thanks in advance!


Report Offensive Message For Removal

Response Number 1
Name: nails
Date: October 17, 2007 at 07:40:13 Pacific
Subject: To find files with different ending
Reply: (edit)

find supports an or statement:

find . \( -name "*.txt" -o -name "*.pdf" \) -print


Report Offensive Follow Up For Removal

Response Number 2
Name: Jenny_2007
Date: October 17, 2007 at 23:17:36 Pacific
Subject: To find files with different ending
Reply: (edit)

Thanks Nails...
I will try that ...


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: To find files with different ending

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software