Thursday, January 19, 2023

To Move the Most Recent Files

This command will move the five most recent files in the ~/Downloads directory to the current directory

 

find ~/Downloads -maxdepth 1 -type f -printf '%T@ %p\n' | sort -rn | cut -d' ' -f2- | head -n 5 | xargs -I{} echo mv {} .

 

to do a dry run! remove echo to actually do it.