Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 08-01-2008, 10:03 PM   #1
LQ Newbie
Registered: Feb 2006
Posts: 21

Rep: Reputation: 15
find -name command finds the wrong files


When I'm running this command.

find -name '*.zip'
I want to found zip files in the current directory, but for some reasons 'find' searches in subdirectory.

How do I make it to search in just the current directory?
Old 08-01-2008, 10:20 PM   #2
ReliaFree Maintainer
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware-current, Cross Linux from Scratch, Gentoo
Posts: 2,779
Blog Entries: 1

Rep: Reputation: 243Reputation: 243Reputation: 243
Use the -maxdepth option.
find -maxdepth 1 -name '*.zip'
Old 08-01-2008, 10:45 PM   #3
Registered: Mar 2008
Location: Baltimore Md
Distribution: ubuntu
Posts: 184

Rep: Reputation: 41
For the current directory why not just use

ls -d *.zip

Last edited by lwasserm; 08-01-2008 at 10:47 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using find and rm command to delete files over x days old 200mg Linux - Newbie 16 09-03-2008 07:41 PM
How to find files and copy the found files to the floppy in one command justmehere Linux - Newbie 11 05-05-2008 12:29 AM
Puppy Linux finds wrong mouse w_r_cromwell Linux - Hardware 0 03-27-2007 10:57 AM
what command can i use to find files of a certain size? abutzki Linux - Newbie 2 01-31-2006 08:43 AM
find and replace in files from command line dexter_modem Linux - General 4 06-10-2003 12:27 PM

All times are GMT -5. The time now is 06:06 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration