I have been looking for quite a while for an answer to this.
My hosting environment will not let me use the find command. Is there a way to search a directory for all files older than 30 days and delete/rm them? Any reading or examples would be greatly appreciated.
Thanks in advance.
Try something like this:
touch -d 'now -30 days' reference_file
for f in *; do
if [ "$f" -ot reference_file ]; then
rm "$f"
fi
done
Or is touch also on the blacklist?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With