The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to find a file named vijay in a directory using find command amirthraj_12 UNIX for Dummies Questions & Answers 6 10-25-2008 01:37 PM
how to use sed or perl command to find and replace a directory in a file wip_vasikaran UNIX for Dummies Questions & Answers 1 08-20-2008 07:22 AM
awk command to find the count of files ina directory sish78 Shell Programming and Scripting 11 07-19-2007 09:00 AM
Help with find command on a shortcut directory(Alias)??? swamy455 UNIX for Dummies Questions & Answers 2 07-07-2005 02:32 PM
using find command only in current directory jliebling UNIX for Dummies Questions & Answers 5 02-22-2001 10:00 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-15-2008
Stephan Stephan is offline
Registered User
  
 

Join Date: Sep 2005
Location: Great White North
Posts: 22
Find command to run only in the base directory

Hi.

I'm trying to get my find command to only search in the directory i tell it to, but i don't want it to search in the sub directories as well...

For example, i have a /data/files/ and /data/files/old

I want to search for all .sav files within /data/files but i don't want it to drill down through the /data/files/old directory...

I tried using maxdepth but i get an error that it is not a valid option. i am sure there is a way to do this?!

thanks!
  #2 (permalink)  
Old 09-15-2008
amsct amsct is offline
Registered User
  
 

Join Date: Aug 2008
Location: Amsterdam, The Netherlands
Posts: 33
find /data/files -depth 1 -name "*.sav"
  #3 (permalink)  
Old 09-15-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,763
try
Code:
find /data/files/ -only  -name '*.sav'
  #4 (permalink)  
Old 09-15-2008
Stephan Stephan is offline
Registered User
  
 

Join Date: Sep 2005
Location: Great White North
Posts: 22
Hi guys. thanks for the quick replies...

I get a missing conjunction when trying to run the -depth option and a "not a valid option" when trying the -only (like when trying to use -maxdepth)...
  #5 (permalink)  
Old 09-15-2008
Stephan Stephan is offline
Registered User
  
 

Join Date: Sep 2005
Location: Great White North
Posts: 22
Well, i finally got this going:

find ./* -prune -type f -name '*.sav'

Seems to do exactly what i want it to...

Thanks
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:47 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0