+ Post New Thread
Results 1 to 3 of 3
*nix Thread, Directory listings in Technical; In Windows I can do: dir /ad win* and I'll get a list of directories whose name starts with "win" ...
  1. #1

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,156
    Thank Post
    116
    Thanked 529 Times in 452 Posts
    Blog Entries
    2
    Rep Power
    124

    Directory listings

    In Windows I can do:

    dir /ad win*

    and I'll get a list of directories whose name starts with "win"

    how can I do the same in Unix?

    If I do

    ls -l win*

    I get the list of directories but I also get the contents of the directory and I don't want that (I'm looking at a list of home folders and want to see those which have not been used recently so I only want to see the folder details, not the contents)

    I've tried using find - I suspect that this will do what I want but I can't work out the switches!

  2. #2

    Join Date
    Feb 2006
    Location
    Derbyshire
    Posts
    1,381
    Thank Post
    181
    Thanked 211 Times in 171 Posts
    Rep Power
    65
    ls -ld win* should work too?

    If you want to make it more handy for comparing the modification dates, try

    ls -ldtr win*

    d = list directory name only, t=show in modification order, r=reverse (so last modded is first)
    Last edited by OutToLunch; 12th June 2009 at 12:25 PM.

  3. #3

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,156
    Thank Post
    116
    Thanked 529 Times in 452 Posts
    Blog Entries
    2
    Rep Power
    124
    Thanks for this; the ls -d command works (ls -ld lets me see the date which is what I most want!)

    I had to do the find as:

    find . -type d -iname "win*" -ls

    which worked but is really slow - it obviously scans every sub-directory. I think I should be able to stick "- prune" in to tell it not to do that but it still takes as long!

    Anyway, I've got what I need so many thanks again - now to get deleting :-)

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 0
    Last Post: 6th April 2009, 10:26 PM
  2. Active Directory
    By Neville in forum Windows
    Replies: 6
    Last Post: 25th June 2008, 03:24 PM
  3. Staff Directory
    By AnnDroyd in forum Web Development
    Replies: 3
    Last Post: 12th February 2008, 12:27 PM
  4. Replies: 7
    Last Post: 31st January 2008, 12:17 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •