find . but not access subdirectories


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting find . but not access subdirectories
# 1  
Old 05-04-2007
find . but not access subdirectories

Hello,

I'm trying to figure out how to prevent this find command from accessing this diretories's subdirectories!

I tried the maxdepth and prune but they don't seem to work on SUN. So now i'm trying to set up a nawk command to not process any files that have "REVISED" in there name:

find . -name "???CQ???.TXT.out" | nawk ~/REVISED/ '{print $1}'

Thanks very much for any help with the find or the nawk commands!

BobK Smilie
# 2  
Old 05-04-2007
Can you just simply use the following?

ls ???CQ???.TXT.out
# 3  
Old 05-04-2007
well i have that same file name ???CQ???... in the parent and sub/child directories, so i want to prevent the child directory file names from being printed.

when i use the ~/REVISED/ it seems to me that should cause the /REVISED/ or child directories to not be printed, so what would the syntax then be to say:

don't print any file name with /REVISED/ in it?

Thanks
BobK
# 4  
Old 05-04-2007
ok got it thanks alot!

find . -name "???CQ???.TXT.out" | awk '$1!~/REVISED/{print $1}'

its the !
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Use ls or find for search of subdirectories?

(5 Replies)
Discussion started by: jhsinger
5 Replies

2. Shell Programming and Scripting

Shell script to find size of subdirectories

Hi I have to find size of subdirectory and automate it in CRON. Eg: parent directory name is NVBKP inside it there are several subdirectories I want to get the size of recent two subdirectories. I have tried ls -ltr diretory path | tail -2 But it is providing only size of the folder not... (8 Replies)
Discussion started by: ankit2012
8 Replies

3. UNIX for Dummies Questions & Answers

Find directories without subdirectories

Hello, I have to find all directories, which contain files, but dont have subdirectories. For example if i have tree like: ├── kat11 │ ├── kat21 │ │ └── Dokument\ bez\ nazwy │ └── kat22 │ ├── kat31 │ │ └── Dokument\ bez\ nazwy │ └── kat32 │ └──... (13 Replies)
Discussion started by: eValker
13 Replies

4. Shell Programming and Scripting

Find *.tar files under all subdirectories

Hi there, I'm new to shell scripting... I've a situation like to find *.tar files under all subdirectories in "/home/abcd" and i used the below, find /opt/lhapp ! -name "temp" | more the above works fine.. Now don't need search few direcotries like "/home/abcd/aaaa",... (15 Replies)
Discussion started by: skcvasanth
15 Replies

5. Shell Programming and Scripting

Find directory name while traversing subdirectories

Hi, I have a parent directory in which I have sub directories of different depth /usr/usr1/user2/671 /usr/usr1/672 /usr/user2/user1/673 /usr/user2/user3/user4/674 And I need the names of all the directories that which starts only with 6 in a file. Thanks, (12 Replies)
Discussion started by: arun_maffy
12 Replies

6. Shell Programming and Scripting

How to find files only inside the subdirectories only?

Hi I have a directory with two subdirectories and also have a code like below to search files modified in last 2 minutes. # ls hello080909.txt inbox outbox # find . -type f -mmin +2 ./inbox/hello2080909.txt ./outbox/hi0080909.txt ./hello080909.txt The above code just searches and... (3 Replies)
Discussion started by: Tuxidow
3 Replies

7. UNIX for Dummies Questions & Answers

Find Files in a Directory Excluding Subdirectories

Hi, I have a filename Location.txt in a directory /abc. Similar name file is present in its subdirectory /abc/xyz. I want to find the file which is present only in /abc and not in /abc/xyz. Please any1 of u can provide a quick suggestion. Its very urgent. Thanks, Amol (2 Replies)
Discussion started by: Amol_Dicholkar
2 Replies

8. Shell Programming and Scripting

Find files ignoring subdirectories

Hi guys, I am searching some files not equal to the pattern with this command find ! -name "PATTERN" -type f but my problem is the find command because he also search inside subdirectories and that's the thing i don't want that. Is there any comand to ignore the directories... (4 Replies)
Discussion started by: osramos
4 Replies

9. UNIX for Dummies Questions & Answers

Possible to give sudo access to subdirectories?

Say I want to give someone access to /example/directory/* where * equals all the sub directories inside of /example/directory I tried doing something like joe DEV1=(ROOT) /example/directory/ But that doesn't seem to want to work. If I give him the full subdirectory... (3 Replies)
Discussion started by: LordJezo
3 Replies
Login or Register to Ask a Question