From 6520c62b9ce5f514015e732e93cfc7d99a067918 Mon Sep 17 00:00:00 2001 From: Christoph Date: Mon, 2 Apr 2018 19:35:34 +0200 Subject: [PATCH] Remove unused code. --- clean_samba_trash.sh | 12 +++++------- cleanup_samba_rights.sh | 32 -------------------------------- 2 files changed, 5 insertions(+), 39 deletions(-) diff --git a/clean_samba_trash.sh b/clean_samba_trash.sh index 3ac831b..040e210 100755 --- a/clean_samba_trash.sh +++ b/clean_samba_trash.sh @@ -150,15 +150,13 @@ traverse() { while IFS='' read -r -d '' name ; do - if [[ -d $name ]] ; then - [[ "$name" = ".." ]] && continue - [[ "$name" = "." ]] && continue - traverse "$name" - fi + [[ "$name" = ".." ]] && continue + [[ "$name" = "." ]] && continue + traverse "$name" - find "$1" -type f -mtime +${days} -exec rm -f "{}" \; > /dev/null 2>&1 + done < <(find "$1" -mindepth 1 -maxdepth 1 -type d -print0) - done < <(find "$1" -mindepth 1 -maxdepth 1 -print0) + find "$1" -mindepth 1 -maxdepth 1 -type f -mtime +${days} -exec rm -f "{}" \; > /dev/null 2>&1 } diff --git a/cleanup_samba_rights.sh b/cleanup_samba_rights.sh index 451f48f..9e8040e 100755 --- a/cleanup_samba_rights.sh +++ b/cleanup_samba_rights.sh @@ -5,35 +5,3 @@ echo " Moved to git repository 'admin-stuff'. Scriptname: set_directory_permis echo "" exit 0 - -base_dir=$1 -group=$2 - -file_perm=${3:-664} -dir_perm=${4:-2775} - -set_also_base_dir=${5:-false} - -if $set_also_base_dir ; then - chmod $dir_perm $base_dir - chgrp $group $base_dir -fi - -while IFS='' read -r -d '' filename ; do - - [[ -f "$filename" ]] && ( chmod $file_perm "$filename"; chgrp $group "$filename") - [[ ! -d "$filename" ]] && continue - - [[ "$filename" =~ .Trash ]] && continue - [[ "$filename" = "lost+found" ]] && continue - - chmod $dir_perm "$filename" ; chgrp $group "$filename" - - find "$filename" ! -group $group -exec chgrp -R $group {} \; - find "$filename" -type d ! -perm $dir_perm -exec chmod -R $dir_perm {} \; - find "$filename" -type f ! -perm $file_perm -exec chmod -R $file_perm {} \; - - -done < <(find $base_dir -mindepth 1 -maxdepth 1 -print0) - -exit 0