Skip to content

Instantly share code, notes, and snippets.

@laemmy
Last active February 8, 2019 09:51
Show Gist options
  • Save laemmy/264273bfa12629b87eb0e401ca39e7a0 to your computer and use it in GitHub Desktop.
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.
#!/bin/bash
find /srv/samba -type d -name '__Trash'> /tmp/trash
while read line;
do
find $line -mtime +90 -delete
done < /tmp/trash
@laemmy
Copy link
Author

laemmy commented Feb 8, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment