Initial import
This commit is contained in:
34
clean_trash.sh
Executable file
34
clean_trash.sh
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
trash_dirs="/data/buero/.Trash /data/ajur/.Trash /data/scan/.Trash /data/datev/.Trash"
|
||||
days=31
|
||||
|
||||
traverse() {
|
||||
|
||||
for file in `ls -a $1` ; do
|
||||
if [ -d $1/$file ] ; then
|
||||
[ "$1/$file" = "$1/.." ] && continue
|
||||
[ "$1/$file" = "$1/." ] && continue
|
||||
traverse $1/$file
|
||||
fi
|
||||
done
|
||||
|
||||
find $1 -type f -mtime +${days} -exec rm -f "{}" \;
|
||||
|
||||
## - leere Unterverzeichnisse löschen
|
||||
#find $1 -depth -mindepth 1 -type d -empty -exec rmdir "{}" \;
|
||||
|
||||
}
|
||||
|
||||
for dir in $trash_dirs ; do
|
||||
traverse "$dir"
|
||||
done
|
||||
|
||||
## - lösche leere (Unter-)Verzeichnisse
|
||||
## -
|
||||
for dir in $trash_dirs ; do
|
||||
#find $dir -depth -mindepth 2 -type d -empty -exec rmdir "{}" \;
|
||||
find $dir -depth -mindepth 2 -type d -empty -delete
|
||||
done
|
||||
|
||||
exit
|
||||
Reference in New Issue
Block a user