Moving files Older than 7 days. | linux centos moving old files 7 days find /var/log/source/ -mtime 7 -exec mv “{}” /tmp/destination \;

A incident came through to me this morning stating /var is getting full (95%).

I wanted a command which will quick go through the contents of the directory and move anything older than 7 days to /tmp.

Moving the files will get me out of trouble fast and allow me to compress the data in the temp location.

See command below.

 

Leave a Reply

Your email address will not be published. Required fields are marked *