find directory with 2 types of files


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers find directory with 2 types of files
# 1  
Old 10-13-2004
find directory with 2 types of files

Trying to use the find command to find any directory which contains a file ending in .zip AND a file ending in .o

I'm having trouble specifying multiple files as criteria and have can't seem to figure it out from Unix in a Nutshell and Google.
# 2  
Old 10-13-2004
Example
Code:
SOURCE_DIR="some directory path"

find $SOURCE_DIR \( -name "*.pc" -o -name "*.C" -o -name "*.mak" \) -exec ls -1 {} \;

# 3  
Old 10-13-2004
exactly what I was looking for...I had been doing -name \( "*.zip" -a "*.o" \)
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Script to find file types and info

I'm looking for a way to inventory files on a webserver into a CSV file, and am particularly interested in certain types of files, like .php, .cgi, .pl, .py, .sh, etc. but also want the ability to find all files, including those with no extension, or specified extensions, as above, including files... (1 Reply)
Discussion started by: spacegoose
1 Replies

2. UNIX for Advanced & Expert Users

Find all files in the current directory excluding hidden files and directories

Find all files in the current directory only excluding hidden directories and files. For the below command, though it's not deleting hidden files.. it is traversing through the hidden directories and listing normal which should be avoided. `find . \( ! -name ".*" -prune \) -mtime +${n_days}... (7 Replies)
Discussion started by: ksailesh1
7 Replies

3. Shell Programming and Scripting

Using a single "find" cmd to search for multiple file types and output individual files

Hi All, I am new here but I have a scripting question that I can't seem to figure out with the "find" cmd. What I am trying to do is to only have to run a single find cmd parsing the directories and output the different file types to induvidual files and I have been running into problems.... (3 Replies)
Discussion started by: swaters
3 Replies

4. Shell Programming and Scripting

bash: find multiple types[solved]

Hi, I would like to use find to search for multiple types. For example search for symlink and regular file but not directories, sockets etc.... Something like: find . -type l,f -name "stuff" But of course it does not work. Is there any way to avoid an if statement and to do it faster? ... (0 Replies)
Discussion started by: Dedalus
0 Replies

5. Shell Programming and Scripting

Remove two types of files from a directory

Hi All, i need to move two types of files from a directory. I have used the below command to find the files from the directory.. SOURCE_DIR="some directory path" TARGET_DIR="Target Dir" Datestamp=Date_format find $SOURCE_DIR \( -name "*.log" -o -name "*.out" ) - exec ls -1 {} \; now i... (9 Replies)
Discussion started by: ch33ry
9 Replies

6. UNIX for Dummies Questions & Answers

How to find the partition types in linux

How do we find the partition type in Linux? df -T will give me the mounted partition types like ufs, ext3 etc. How do I find out for say a newly added disk to the system? Please advise... Thanks (2 Replies)
Discussion started by: lubu
2 Replies

7. Linux

Simplified find command to find multiple file types

Hi, I'm using the following command to find the multiple requierd file types and its working fine find . -name "*.pl" -o -name "*.pm" -o -name "*.sql" -o -name "*.so" -o -name "*.sh" -o -name "*.java" -o -name "*.class" -o -name "*.jar" -o -name "*.gz" -o -name "*.Z" -type f Though... (2 Replies)
Discussion started by: vickramshetty
2 Replies

8. UNIX for Dummies Questions & Answers

Types of File in a directory

Hello, I have several thousand files with different extensions in a directory. Is there a single command to get what the various extensions are with a single command. Thanks for your help! Best, Guss (2 Replies)
Discussion started by: Gussifinknottle
2 Replies

9. UNIX for Dummies Questions & Answers

Find files and display only directory list containing those files

I have a directory (and many sub dirs beneath) on AIX system, containing thousands of file. I'm looking to get a list of all directory containing "*.pdf" file. I know basic syntax of find command, but it gives me list of all pdf files, which numbers in thousands. All I need to know is, which... (4 Replies)
Discussion started by: r7p
4 Replies

10. Shell Programming and Scripting

Find duplicates from multuple files with 2 diff types of files

I need to compare 2 diff type of files and find out the duplicate after comparing each types of files: Type 1 file name is like: file1.abc (the extension abc could any 3 characters but I can narrow it down or hardcode for 10/15 combinations). The other file is file1.bcd01abc (the extension... (2 Replies)
Discussion started by: ricky007
2 Replies
Login or Register to Ask a Question