Jump to content

Recommended Posts

Posted

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!

Posted (edited)

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)

Edited by OutToLunch
Posted

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 :-)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...