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
list the files but exclude the files in subdirectories shyjuezy UNIX for Dummies Questions & Answers 8 10-15-2008 10:42 AM
get command to ftp subdirectories at once lydiaEd UNIX for Dummies Questions & Answers 3 12-07-2007 12:06 AM
FTP command to search recursively in windows folder lakshmis10 Shell Programming and Scripting 6 10-18-2007 02:09 AM
list largest files in a directory & its subdirectories igidttam UNIX for Dummies Questions & Answers 6 09-25-2006 08:31 AM
List Files Recursively roberthawke UNIX for Dummies Questions & Answers 9 06-24-2002 03:19 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 11-21-2005
Registered User
 

Join Date: Mar 2005
Posts: 34
Question ls command to list recursively ONLY subdirectories


ls -dlRr
I've tried different combinations of the ls command using the above-mentioned options but none of them are giving me the output I am looking for.

Objective: To get a recursive listing of all subdirectories from a particular starting point. For example, if my starting point is directory A, and directory A contains subdirectories B, C, D, and each of the subdirectories contains a combination of directories and files called B1, C1, D1, etc., I want a recursive listing of the subdirectories contained, so the output will be something like
A
./B
./B1
./C1
etc. while excluding the list of the individual files.

I tried doing a search for 'ls' in the forum but didn't see anything within the first two pages of the results that the search pulled.

Help please!

Thanks!

- Hae

--- Edit ---

Nevermind! Found the answer at Recursive directory listing without listing files

Last edited by HLee1981; 11-21-2005 at 03:08 PM.
Reply With Quote
Forum Sponsor
  #2  
Old 11-21-2005
RTM's Avatar
RTM RTM is offline
Hog Hunter
 
Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
find /A -type d -ls
or
find /A -type d -ls |awk '{print $10}'
Reply With Quote
  #3  
Old 11-21-2005
Registered User
 

Join Date: Mar 2005
Posts: 34
Quote:
Originally Posted by RTM
find /A -type d -ls
or
find /A -type d -ls |awk '{print $10}'
RTM, neither of the commands worked using the find/A prefix. The result I get is find: cannot open /A: No such file or directory.

I tried it using a lowercase a after the /.

Thanks.
Reply With Quote
  #4  
Old 11-21-2005
bhargav's Avatar
Registered User
 

Join Date: Sep 2004
Location: USA
Posts: 511
what about

Code:
ls -Rl | grep "[a-z]:" | sed 's/://'
Reply With Quote
  #5  
Old 11-21-2005
RTM's Avatar
RTM RTM is offline
Hog Hunter
 
Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
Yea, sorry about that - you probably don't have a /A - but I was more using your example
Quote:
For example, if my starting point is directory A
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 09:37 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