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 > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

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
Help Required: Command to find IP address and command executed of a user loggedout Security 2 08-06-2008 09:12 PM
Little bit weired : Find files in UNIX w/o using find or where command jatin.jain Shell Programming and Scripting 10 09-19-2007 07:47 AM
command find returned bash: /usr/bin/find: Argument list too long yacsil Shell Programming and Scripting 1 12-15-2003 06:38 PM
how to find a file in UNIX without find command? bluo Shell Programming and Scripting 3 09-25-2003 12:47 AM

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 01-23-2008
rudoraj rudoraj is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 41
Help with Find command

I have some files and directories in a folder.
I would like to search only the files and not look within the directory or subdirectory.

how can i do that using find command.

Thank you
  #2 (permalink)  
Old 01-23-2008
bobbygsk bobbygsk is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 90
Why do you need find command for that.
You can do it with "ls" command.
  #3 (permalink)  
Old 01-23-2008
rudoraj rudoraj is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 41
the idea is to find only the files and then move it to some specific location.
The logic is already in place which uses find command to do it, now i want to restrict it for looking into directories.
  #4 (permalink)  
Old 01-23-2008
varungupta varungupta is offline
Registered User
  
 

Join Date: Feb 2007
Location: Pune, Dehradun (INDIA), Michigan(US)
Posts: 206
Quote:
Originally Posted by rudoraj View Post
I have some files and directories in a folder.
I would like to search only the files and not look within the directory or subdirectory.

how can i do that using find command.

Thank you
hey,

Try following command...

Find . "filename" type -f -name -print

this command will find all the files in the present location/directory, so you can first move to desired location and then hit the above command to get the files.

Otherwise you can use like : "/clocal/yourlocation/directory"

Thanks.
  #5 (permalink)  
Old 01-25-2008
vbe's Avatar
vbe vbe is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2005
Location: Switzerland - GE
Posts: 1,575
What do you do about links then?
  #6 (permalink)  
Old 02-02-2008
stv_t stv_t is offline
Registered User
  
 

Join Date: Jan 2008
Location: Gatwick, UK
Posts: 6
Hi,

I already do something like this when searching for a particular file.

find * -prune ! -type d -name 'filename' | xargs -I{} mv {} $target_dir
* tells find to look at everything in the current directory.
-prune - tells it to ignore anything in sub-directories
! -type d - lists everything that is not a directory.
The output is then passed to xargs to actually move the files
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 05:48 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