Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Delete old uploads
#1

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.

Code:
#!/bin/sh

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

[Image: kavove-zrnka-lajna.jpg]
Coffee phreak!
Reply




Users browsing this thread: 1 Guest(s)