Guntis
Cadet
- Joined
- May 18, 2016
- Messages
- 4
I found this:
here: https://forums.freebsd.org/threads/44848/
I think this will work for all shares if I modify it like this
there is also this:
that is written for Ubuntu, but in comments they say that it works for freenas too.
I will report back if this works.
Code:
find /mnt/*/.Trashes/ -type f -mtime +5d -delete find /mnt/*/.Trashes/ -type d -empty -depth -delete find /mnt/*/.Trashes/ -type f -mtime +5d -exec rm -fv {} \; find /mnt/*/.Trashes/ -type d \! -path "*/" -empty -depth -exec rm -frv {} \;
here: https://forums.freebsd.org/threads/44848/
I think this will work for all shares if I modify it like this
Code:
find /mnt/<pool_name>/*/.recycle/ -type f -mtime +5d -delete find /mnt/<pool_name>/*/.recycle/ -type d -empty -depth -delete find /mnt/<pool_name>/*/.recycle/ -type f -mtime +5d -exec rm -fv {} \; find /mnt/<pool_name>/*/.recycle/ -type d \! -path "*/" -empty -depth -exec rm -frv {} \;
there is also this:
Code:
#!/bin/bash ### # meant to cleaup deleted/recycled files & folders # they will have been kept for a while, probably 7 days # then cleared out with this script, run from cron/anacron ### # Create Temp Log File RUNON=$(date +"%F__%R") TMPLOGFILE=$(mktemp "houseCleaning_$RUNON.XXXXXXXXX" --tmpdir=$TMPDIR) LOGDIR=/var/log LOGFILE=$LOGDIR/houseCleaning.log # Find and Log files older than 7 days old echo "finding files deleted more than 7 days ago" >> $TMPLOGFILE find /mnt/vol0/*/.recycle/* -type f -mtime +7 >> $TMPLOGFILE # Delete files older than 7 days find /mnt/vol0/*/.recycle/* -type f -mtime +7 -delete # Find and Log empty directories echo "finding empty directories" >> $TMPLOGFILE find /mnt/vol0/*/.recycle/* -type d -empty >> $TMPLOGFILE # Delete empty directories find /mnt/vol0/*/.recycle/* -type d -empty -delete # Find and Log empty files echo "finding empty files" >> $TMPLOGFILE find /mnt/vol0/*/.recycle/* -type f -empty >> $TMPLOGFILE # Delete empty files find /mnt/vol0/*/.recycle/* -type f -empty -delete # Update Log File echo "Script: $0" >> $LOGFILE echo "Executed: $RUNON" >> $LOGFILE cat $TMPLOGFILE >> $LOGFILE echo "------------------" >> $LOGFILE
that is written for Ubuntu, but in comments they say that it works for freenas too.
I will report back if this works.