Search code examples
filecronmove

cron job to move 10 day old files to different directory


I need a script that I can run from a cron job to move files that are 10 days old or older to a different directory. Being a windows sys admin, I have no idea what I'm doing in linux. :( Can someone point me in the right direction?

Thanks in advance.


Solution

  •     find /source/directory/* -mtime +10 -exec mv "{}" /my/directory \;
    

    Use 'crontab -e' to open your crontab and set it to run as needed.