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
Using Deep Packet Inspection iBot IT Security RSS 0 05-29-2008 07:50 AM
Forcing UID on Files/Dirs Created with SFTP? deckard UNIX for Dummies Questions & Answers 5 05-28-2008 07:19 AM
monitoring dirs da-seot Shell Programming and Scripting 1 09-02-2007 11:55 PM
Traversing thru dirs and deleting files based on date ravi2082 Shell Programming and Scripting 5 07-18-2007 01:28 PM
recursion too deep swamy455 Shell Programming and Scripting 3 07-18-2005 12:18 PM

Closed Thread
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 09-12-2003
Registered User
 

Join Date: Sep 2003
Posts: 2
I need to ls all files in 4-6 deep dirs

I need to print to file , a listing of all files below a certain directory.
Example: I need to print to file a listing of all files below the etc dir (including the subdirectories) with their full path. Any ideas on how to do this with one command. Or is this something I need to do on all directories ie... ls -??
TIA!
Forum Sponsor
  #2  
Old 09-12-2003
davidg's Avatar
Registered User
 

Join Date: Jul 2003
Location: Holland
Posts: 207
Hi,

The solution can be :

find /etc >/tmp/output

This will list all files and directories under /etc as a name.

If you want files and directories seperated you can do this :

find /etc -type d >/tmp/output_directory
find /etc -type f >/tmp/output_files

Or if you want a ls -l listing of each file :

find /etc -type f -exec ll {} \; >/tmp/long_outp_f
find /etc -type d -exec ls -lad {} \; >/tmp/long_outp_d


Good luck.

Regs David
  #3  
Old 09-12-2003
Registered User
 

Join Date: Sep 2003
Posts: 2
Thanks David, that did it!
  #4  
Old 09-18-2003
Kelam_Magnus's Avatar
Registered User
 

Join Date: Aug 2001
Location: DFW McKinney, TX,
Posts: 1,069
Gforty...

IF you need to do precise directories a certain depth... use the -depth option for find...
__________________
My brain is your brain
  #5  
Old 09-18-2003
criglerj's Avatar
Registered User
 

Join Date: May 2002
Location: Atlanta
Posts: 129
Quote:
Originally posted by Kelam_Magnus
Gforty...

IF you need to do precise directories a certain depth... use the -depth option for find...
I hit a cognitive dissonance with my recollection when I read this one: On Solaris, the BSDs and others, the -depth option (which may or must be specified as -d on most of these) -depth means "do depth-first traversal". On Linux distros (slackware 3.x, Redhat 7.3, Suse x.x) there are also options -mindepth and -maxdepth which give behavior along the lines of Kelam_Magnus's suggestion.

The moral: Check your own local manpages!
Google The UNIX and Linux Forums
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 08:14 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0