Last active
February 8, 2019 09:51
-
-
Save laemmy/264273bfa12629b87eb0e401ca39e7a0 to your computer and use it in GitHub Desktop.
Searching for Traschcan Folders on Samba Fileserver and delete files older than 90 days.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
find /srv/samba -type d -name '__Trash'> /tmp/trash | |
while read line; | |
do | |
find $line -mtime +90 -delete | |
done < /tmp/trash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can also use this oneliner, If you don't care for empty folders which not will be deleted.
find /srv/samba -type f -path '/__Trash/' -mtime +90 -delete