Вопрос

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

Это было полезно?

Решение

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 '^(\.|\.\.)$'

Другие советы

It's easier to do

find . -type d -cmin -60 -print

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top