Is there any sort option available in find command to get directory with least access date/time
相关问题
- How to get the return code of a shell script in lu
- Is shmid returned by shmget() unique across proces
- how to get running process information in java?
- JQ: Select when attribute value exists in a bash a
- Invoking Mirth Connect CLI with Powershell script
the below linux command displays the access and modified time along with size
stat -f
This sound like more of a job for
ls
:The problem with using
find
, at least on my system (cygwin/bash), is thatfind
accesses the dirs, so all access-times result in current time, defeating your apparent purpose.If you prefer the filename without leading path, replace
%p
by%f
.source
A simple shell script will also do:
note: to find the oldest directory use
"$dir"/*/
above (thanks Cyrus) and-type d
below with thefind
command.In bash if you need a recursive solution, then you can rewrite it as a while loop with process substitution using
find