Linux

Copy the last modified file

2022-03-08  本文已影响0人  JaedenKil

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
上一篇下一篇

猜你喜欢

热点阅读