I’ve installed File Server on my Nethserver for folder sharing. I’ve enabled the Recycle Bin on a folder where nightly older files are automatically deleted. It appears my Recycle Bin folder for this file share has grown very large. I’ve asked this question before but wanted to confirm the answer:
Would the above script go through all my shared folder recycle bins and delete any files older than 30 days?
Is the preferred method still to use this in a cron job to clean up my recycle bin? Or is there a way now within the Nethserver/Cockpit GUI to setup this task?
Any advice for me on how to reduce the size of my recycle bin?
URF=$(find “/var/lib/nethserver/nextcloud/Frederik_POLLET/files/00. MyOwnFiles/01. Tekstbestanden/001. BOEKHOUDING PRO/.Prullenbak/”* -type f -atime +7)
if [ “$URF” != “” ]
then
printf " %-126s \n" “De volgende bestanden uit de prullenbak van Frederik (accdocspro) werden verwijderd :”
IFS=$‘\n’
for file in $URF
do
printf " - %-124s \n" “$file”
rm -f “$file”
done
else
printf " %-126s \n" “Er werden geen oude bestanden uit de prullenbak van Frederik (accdocspro) verwijderd.”
fi
URD=$(find “/var/lib/nethserver/nextcloud/Frederik_POLLET/files/00. MyOwnFiles/01. Tekstbestanden/001. BOEKHOUDING PRO/.Prullenbak/”* -type d -empty)
if [ “$URD” != “” ]
then
printf " %-126s \n" “De volgende lege mappen uit de prullenbak van Frederik (accdocspro) werden verwijderd :”
IFS=$‘\n’
for folder in $URD
do
printf " - %-124s \n" “$folder”
rm -rf “$folder”
done
else
printf " %-126s \n" “Er werden geen lege mappen uit de prullenbak van Frederik (accdocspro) verwijderd.”
fi
Thank you Frederik for your reply. But it appears your script handles the recycle bin for Nextcloud. If I’m not mistaken I thought there was a setting in the Nextcloud config to set the retention period for how long to keep files in the recycle bin.
For my case I’m looking to cleanup files in my Shared Folder (in File Server) on my Nethserver. I’ve tried using the following command:
This appears to be working to cleanup any files in my Recycle bin that are older than 10 days. But when I look at the size of my Shared Folders in Nethserver I don’t see the Size reduced. I’ve confirmed that the recycle bin folder does have less files now. @support_team, is there something more I need to do in order to reclaim the used space my recycle bin had taken up before I ran my cleanup script?
Much appreciative of your input @Andy_Wismer! I can see this morning that the size of my shared folder has been now greatly reduced reflecting the cleanup I did yesterday.
I will now install crontab manager to setup a regular task to keep my shared folder recycle folders clean.