Bash script to find and display oldest file

前端 未结 4 1254
梦如初夏
梦如初夏 2021-01-21 13:26

I\'m trying to write a script that will display the name of oldest file within the directory that the script is executed from.

This is what I have so far:



        
4条回答
  •  孤城傲影
    2021-01-21 14:11

    The following oneliner finds the oldest file in the whole subtree and reports it using the long format and relative full path. What else could you ever need?

    ls -ltd $(find . -type f) | tail -1
    

提交回复
热议问题