I have a bash script:
for entry in "/home/pictures"/*
do
echo "ls -larth $entry"
done
It must be a bash script, because some other software (Jenkins) will call it .
尝试查找。
find /home/pictures -type f -exec ls -l --full-time {} \; | sort -k 6
If there are no newlines in file names use:
find /home/pictures -type f -printf '%T@ %p\n'|sort -n
If you can not tolerate timestamps in output, use:
find /home/pictures -type f -printf '%28T@ %p\n' | sort -n | cut -c30-
If there is possibility of newlines in file name , and , if you can make the program that consumes the output accept null terminated records, you can use:
find /home/pictures -type f -printf '%T@,%p\0' | sort -nz
For no timestamps in output, use:
find /home/pictures -type f -printf '%28T@ %p\0' | sort -nz | cut -zc30-
PS I have assumed that you want to sort by last modification time.
I found out the solution for my question:
find . -name * -exec ls -larth {} +
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.