Delete old uploads - Printable Version

+- (
+-- Forum: My creations (
+--- Forum: Bash scripts (
+--- Thread: Delete old uploads (/thread-136.html)

Delete old uploads - Ashus - 8.2.2013

To automatically delete older uploads, use this and add the script to your cron. +7 means files need to be older than 7 days, files beginning with a dot and a folder "up" is ignored.


for s in $(find /var/www/files/upload/ -type f -mtime +7 -exec echo {} \; | egrep -v "/var/www/files/upload/(\.|up/)")
    rm "$s"