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 11:50 AM
Forcing UID on Files/Dirs Created with SFTP? deckard UNIX for Dummies Questions & Answers 5 05-28-2008 11:19 AM
monitoring dirs da-seot Shell Programming and Scripting 1 09-03-2007 03:55 AM
Traversing thru dirs and deleting files based on date ravi2082 Shell Programming and Scripting 5 07-18-2007 05:28 PM
recursion too deep swamy455 Shell Programming and Scripting 3 07-18-2005 04:18 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 Rating: Thread Rating: 1 votes, 3.00 average. Display Modes
  #1 (permalink)  
Old 09-12-2003
gforty gforty is offline
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!
  #2 (permalink)  
Old 09-12-2003
davidg's Avatar
davidg davidg is offline
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 (permalink)  
Old 09-12-2003
gforty gforty is offline
Registered User
  
 

Join Date: Sep 2003
Posts: 2
Thanks David, that did it!
  #4 (permalink)  
Old 09-18-2003
Kelam_Magnus's Avatar
Kelam_Magnus Kelam_Magnus is offline Forum Advisor  
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...
  #5 (permalink)  
Old 09-18-2003
criglerj's Avatar
criglerj criglerj is offline
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!
Closed Thread

Bookmarks

Tags
suse linux

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 04:36 PM.


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