美文网首页Linux
Copy the last modified file

Copy the last modified file

作者: JaedenKil | 来源:发表于2022-03-08 13:43 被阅读0次

Say I'm in folder /c/Users/hatter/Documents/202203(WSL), I need to copy the last downloaded file to this folder:

folder=../../Downloads/; ls -tr $folder | tail -n 1 | xargs -I{} cp $folder{} .
# https://man7.org/linux/man-pages/man1/ls.1.html
-t     sort by time, newest first; see --time

相关文章

网友评论

    本文标题:Copy the last modified file

    本文链接:https://www.haomeiwen.com/subject/ywjarrtx.html