diff --git a/README.md b/README.md index d2f1182..71a9a22 100644 --- a/README.md +++ b/README.md @@ -100,9 +100,15 @@ $ curl -F "oneshot=@x.txt" "" ``` #### Cleaning up expired files +Change `/path/to/rusty` to your rustypaste folder and put this script in the `cron`. ```sh -$ find upload/ -maxdepth 2 -type f -iname "*.[0-9]*" -exec rm -v {} \; +#!/bin/env sh +now=$(date +%s) +find /path/to/rusty/ -maxdepth 2 -type f -iname "*.[0-9]*" | +while read filename; do + [ "$(( ${filename##*.} / 1000 - ${now} ))" -lt 0 ] && rm ${filename} +done ``` #### URL shortening