Performing a non-recursive find in Unix


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Performing a non-recursive find in Unix
# 1  
Old 09-05-2002
Question Performing a non-recursive find in Unix

I need to perform a non-recursive find in Unix. Sounds simple, but it doesn't actually work. The command ALWAYS searches through the subdirectories.

Any ideas? I am on DEC Unix :-(
# 2  
Old 09-06-2002
use the find command with -xdev option

eg

find / -name (search file) -xdev
# 3  
Old 09-06-2002
CPU & Memory No Problem !! Take it easyyy

Ur problem is that U had not gone the man pages of find
Please make sure U read the help pages of find .

Acctually find ->> utility recursively descends the directory
hierarchy for each path seeking files that match......
so please checkout with UNIX man pages and try it

it would fun if U could use grep or fgrep with find ....
Please try it and reply
# 4  
Old 09-06-2002
The xdev option will work only if all of his subdirectories are mount points. Not exactly a general solution.

If want to keep find in one directory, replace
find dir ...
with:
find dir \( ! -name dir -prune \) ...

So
find . -type d -print
will list each subdirectory all the way down your directory structure. But:
find . \( ! -name dir -prune \) -type d -print
will list only the subdirectories in the current directory.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Recursive Find on file size

Is there a way to use the find command to recursively scan directories for files greater than 1Gb in size and print out the directory path and file name only? Thanks in advance. (6 Replies)
Discussion started by: jimbojames
6 Replies

2. UNIX for Dummies Questions & Answers

Non Recursive Find Command

Hello Unix Gurus, I am using the following find commands: 1) find Input_Path -name '*.' -exec mv -f {} Outputpath \; 2) find Inputpath -name '*.' -exec cp {} Outputpath \; 3) find Somepath -name '*.' Now the problem is my Unix version does not support maxdepth Option for find... (7 Replies)
Discussion started by: pchegoor
7 Replies

3. UNIX for Dummies Questions & Answers

Some advice please on non-recursive find

Hi all, I am currently writing a find-and-remove kind of script that is to be used for Solaris and Linux. Currently am using the find command below that I is in find only current directory (universal) | commandlinefu.com This however gives me the "ksh: /bin/find: arg list too long" error... (6 Replies)
Discussion started by: newbie_01
6 Replies

4. Shell Programming and Scripting

How to find the latest file on Unix or Linux (recursive)

Hi all, I need to get the latest file. I have found this command "ls -lrt" that is great but not recursive. Can anyone help? Thanx by advance. (7 Replies)
Discussion started by: 1or2is3
7 Replies

5. UNIX for Advanced & Expert Users

Non recursive find command

Hi, I have question is related to find command. I want to find command should search in current folder only not recursive mode(sub-folders). I found a one way of, find . \( -name success -prune \) -o -name "Rajini*" How ever, my current folder is having lots sub-folders and am not... (7 Replies)
Discussion started by: Nagapandi
7 Replies

6. Shell Programming and Scripting

Recursive find and store

I HAVE A TEXT FILE CONTAINING THE VALUES 1.CPP 2.CPP 3.CPP 4.CPP 5.CPP 6.CPP I WANT TO TAKE EACH .CPP AND USE THE FIND COMMAND TO FIND THE LATEST VERSION OF THE FOLDER IN WHICH IT IS PRESENT. HOW DO I IMPLEMENT IT IN A WHILE LOOP I TRIED SOMETHING LIKE THIS WHILE CAT... (3 Replies)
Discussion started by: ultimatix
3 Replies

7. UNIX for Advanced & Expert Users

identify the unix process performing high disk i/o reads and writes

Guys, Is there any UNIX command that captures the 'Unix process which is performing high disk I/O reads and writes'. can you help me in this? -Swamy (6 Replies)
Discussion started by: avsswamy
6 Replies

8. Shell Programming and Scripting

identify the unix processes performing high disk i/o reads and writes

I would like to write shell/perl script which identifies the top unix processes that are performing high disk I/O's or/and writes If any one knows the solution please help me? -Swamy (0 Replies)
Discussion started by: avsswamy
0 Replies

9. UNIX for Dummies Questions & Answers

making a recursive find more useful..

Hi everyone, I'm using a recursive find (you know the type, find . -name qwert*) to find a set of files. However, because I'm new to the system and there is not much documentation about these particular files I'm trying to find them using this recursive find. I started off at the location... (3 Replies)
Discussion started by: spanish_tony
3 Replies

10. UNIX for Dummies Questions & Answers

Question: non-recursive find syntax

Hello, I am trying to search a directory for all files matching "G*" without looking in sub-directories "success" and "error". I've searched this forum and found the following syntax, but can't make it work: find . \( ! -name success -prune -name error -prune \) -type f -name "G*" Have... (6 Replies)
Discussion started by: alexkav
6 Replies
Login or Register to Ask a Question