cron job to move 10 day old files to different directory?

cron job to move 10 day old files to different directory?

WebApr 5, 2016 · I am trying to create a bash file to run via a cron job that copies, then deletes locally files/directories older than a certain date to Amazon S3 via their CLI. I have the S3 CLI installed and working, just don't know how to write the script to copy and delete files. WebJan 8, 2024 · The race I saw mentioned is this, from Stéphane Chazelas's comment to another question:. Note that -exec rm {} + has race condition vulnerabilities which -delete … asteron life nz payment Webfind /a/b/c/1 /a/b/c/2 -type f -mtime +3 #-delete. Remove the # before the -delete once you are sure that it is finding the files you want to remove. To have it run by cron, I would … WebAug 19, 2012 · This will move all the files older than "2012-08-20" to the folder "/old". Likewise, you can change the "2012-08-20" to specify particular date you want. Note this assumes that the file suffix is a date stamp, but the prefix can be any name. If you just need to move files older than a certain days, then I think rkyser's answer is better for that. 7 sectional sofa WebFeb 2, 2024 · We’ll use this in order to figure out what files are older than a certain number of days, and then use the rm command to delete them. Command Syntax. find /path/to/files* -mtime +5 -exec rm {} \; Note that there are spaces between rm, {}, and \; Explanation. The first argument is the path to the files. WebJan 8, 2024 · I have a cron job that runs at midnight to delete all .txt files in a folder that are older than 7 days. I can see the job is running, but the files still exist in the folder. I'm new to cron, so I'd really appreciate someone pointing out where I've gone wrong, or how to diagnose it if not obvious. Here's my code with the directories obscured: asteron life nz board WebJun 8, 2024 · Setting up a monthly cron job to be run via a script. The script is to rotate a file each month as it gets too big and rename the old one. When a file is older than six months, I wanted it to be deleted. Looking to run this script once a month. Is that possible to get the old one deleted? Please let me know if that isn't clear enough.

Post Opinion