Here’s a simple one for you. I had a directory with tens of thousands of files (images) and I needed to clean it up by moving all the images with a time stamp of 2016 or earlier into another directory.
Step 1 was figuring out how many days it has been between today and 12/31/2016 using this tool:
https://www.timeanddate.com/date/durationresult.html
I came up with 618
Step 2 was running this command:
find . -maxdepth 1 -mtime +618 -type f -exec mv "{}" ~/www/images_bak/uploads \;
Where
. = current directory
-maxdepth 1 = don’t go into subdirectories
-mtime +618 = files more than 618 days old
-type f = files only, no directories
-exec mv “{}” = we want to move the files, not remove them
~/www/images_bak/uploads = directory we want to move them to
Credit for this solution goes to user Jenny D at serverfault.com
I re-write these things cuz I can never find them twice… LOL