The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" Lokesha UNIX for Dummies Questions & Answers 4 12-20-2007 01:52 AM
grep to find content in between curly braces, "{" and "}," keshav_rk Shell Programming and Scripting 4 08-09-2007 10:14 PM
Listing only directories in the current working directory using the "ls" command igandu UNIX for Dummies Questions & Answers 2 05-12-2006 04:47 AM
How to find out the exact year in "Last modified time" using ls command Dophlinne UNIX for Dummies Questions & Answers 6 04-11-2006 11:07 AM
chmod 777 on all directories below...how do I do that using the "find" command? Neko UNIX for Dummies Questions & Answers 7 07-12-2001 09:58 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-17-2006
swamymns swamymns is offline
Registered User
  
 

Join Date: Sep 2005
Posts: 25
"find command" to find the files in the current directories but not in the "subdir"

Dear friends,
please tell me how to find the files which are existing in the current directory, but it sholud not search in the sub directories..

it is like this,

current directory contains
file1, file2, file3, dir1, dir2

and dir1 conatins
file4, file5

and dir2 contains
file6, file7


what i need is when i am in current dir, and if use find command it shold display only
file1, file2, file3

but not others,

please help

very eager to see ur replys..


regards,
swamymns
  #2 (permalink)  
Old 01-17-2006
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
Use the search feature.

advanced/complex uses of the find command
  #3 (permalink)  
Old 01-17-2006
ashterix ashterix is offline
Registered User
  
 

Join Date: Nov 2005
Location: cyberjaya
Posts: 85
if u're using gnu find, u can use -maxdepth option
eg:
$ find . -maxdepth 1 -name file
will show file in the current dir only.
  #4 (permalink)  
Old 07-21-2008
vijayq8 vijayq8 is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 14
Thumbs up vijay

find *.*
  #5 (permalink)  
Old 07-21-2008
cooldude cooldude is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 44
Quote:
Originally Posted by vijayq8 View Post
find *.*
Vijay, that does not work if a sub directory name contains a ".". You may think that's uncommon, but the first time I tried your command, it failed because the directory I was in had a period!
  #6 (permalink)  
Old 07-22-2008
vijayq8 vijayq8 is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 14
Thumbs up

Quote:
Originally Posted by cooldude View Post
Vijay, that does not work if a sub directory name contains a ".". You may think that's uncommon, but the first time I tried your command, it failed because the directory I was in had a period!
Hi,
it should work man, i tried in my unix box then only i posted the reply. see my result.

[mipl@subversion ~]$ ls
coding dead.letter s2.sh scripting sname sorted_names test test1 vijay
[mipl@subversion ~]$ ls -a
. .bash_profile dead.letter .kde sorted_names .viminfo
.. .bashrc .emacs s2.sh test .xemacs
.bash_history .canna .emacs.d scripting test1 .zshrc
.bash_logout coding .gtkrc sname vijay
[mipl@subversion ~]$ find *.*
dead.letter
s2.sh
[mipl@subversion ~]$

Hope you clear now.

Thanks & Regards
Vijay.
  #7 (permalink)  
Old 07-22-2008
Vi-Curious Vi-Curious is offline
Registered User
  
 

Join Date: Jul 2008
Location: Texas
Posts: 129
Quote:
Originally Posted by vijayq8 View Post
Hi,
it should work man, i tried in my unix box then only i posted the reply. see my result.

Hope you clear now.

Thanks & Regards
Vijay.
But, in fact, it doesn't work. Rather, it doesn't do what the original poster asked. It suffers from at least two problems.
1) If there is a sub-directory with a "." in the name, then it will search that sub-directory.
2) It will not find files that do not contain a "." in the name. It is very common for file names not to be of the form x.y.
Sponsored Links
Closed Thread

Bookmarks

Tags
solaris

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 05:17 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