Current location: Hot Scripts Forums » Programming Languages » Other Languages » UNIX ls list on dirs issue


UNIX ls list on dirs issue

Reply
  #1 (permalink)  
Old 01-12-09, 09:40 AM
scott2500uk's Avatar
scott2500uk scott2500uk is offline
Coding Addict
 
Join Date: Apr 2006
Posts: 275
Thanks: 2
Thanked 2 Times in 2 Posts
UNIX ls list on dirs issue

Im trying to list just the directories in my current working dir.

my directory structure as follows:

Code:
|-frintranet
|---Marketing
|-----test
|---Parts
Im using:

Code:
ls -d */
but this returns:

Code:
marketing/
marketingtest/
parts/
why is it returning marketingtest/ when the folder doesnt exist? it wouldnt be so bad if it returned marketing/test/ instead then I wouldnt have to do recursive looks into all the folders.
Reply With Quote
  #2 (permalink)  
Old 01-13-09, 02:45 AM
drowzee drowzee is offline
Newbie Coder
 
Join Date: Dec 2008
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
scott2500uk,

are you sure there is no marketingtest dir? did you try any other way, like 'find'?

% find . -type d -depth 1
Reply With Quote
  #3 (permalink)  
Old 04-02-09, 08:51 AM
atlas29 atlas29 is offline
New Member
 
Join Date: Apr 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Could you also post the results of, say, ls -F or ls -aF for comparison?
Reply With Quote
  #4 (permalink)  
Old 04-02-09, 05:22 PM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
ls -R * | grep ":" | sed "s/://"
Reply With Quote
  #5 (permalink)  
Old 04-02-09, 11:21 PM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
Try:

ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data | Oracle Date & Substring Functions | Code Snippet Library | [url=http://www.codmb.com/Call Of Duty[/url]
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
List box issue jac2703 Windows .NET Programming 2 08-26-08 12:32 PM


All times are GMT -5. The time now is 03:44 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.