Domanda

I want to list all folders inside a folder, created in last n minutes. It should not include the sub folders inside a folder. I tried the following which did not worked

ls   -d  * | find -cmin -60

Please suggest some way

Thanks in advance

È stato utile?

Soluzione

e.g.:

find . -maxdepth 1 -type d -cmin -60 -print | egrep -v '^(\.|\.\.)$' | sed 's/..//'

will find all directories and don't go to sub-dirs, and exclude . and ..

EDIT: now will print instead of ./dir only dir

alternatively,

find . -maxdepth 1 -type d -cmin -60 -printf "%f\n" | egrep -v '^(\.|\.\.)$'

Altri suggerimenti

It's easier to do

find . -type d -cmin -60 -print

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top