mirror of
https://github.com/laurent22/rsync-time-backup
synced 2024-11-10 06:04:18 +00:00
Reverted to use rm
for directory deletion
This commit is contained in:
parent
b85bf9a6e5
commit
8ef83da5d9
1 changed files with 1 additions and 24 deletions
|
@ -72,7 +72,7 @@ fn_expire_backup() {
|
|||
fi
|
||||
|
||||
fn_log_info "Expiring $1"
|
||||
fn_rm_dir_fast "$1"
|
||||
fn_rm_dir "$1"
|
||||
}
|
||||
|
||||
fn_parse_ssh() {
|
||||
|
@ -112,33 +112,10 @@ fn_rm_file() {
|
|||
fn_run_cmd "rm -f -- '$1'"
|
||||
}
|
||||
|
||||
# Removes a directory
|
||||
fn_rm_dir() {
|
||||
fn_run_cmd "rm -rf -- '$1'"
|
||||
}
|
||||
|
||||
# This is an optimized way to delete a directory. It only makes sense to use
|
||||
# it when deleting huge directories, so it's only for expiring backups at
|
||||
# the moment.
|
||||
fn_rm_dir_fast() {
|
||||
local DIR="$1"
|
||||
|
||||
if [[ -z $DIR ]]; then
|
||||
fn_log_error "Directory path is empty - aborting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DIR="$DIR/"
|
||||
|
||||
if [[ -d $DIR && ! -L $DIR ]]; then
|
||||
fn_run_cmd "mkdir -p /tmp/rsync-time-backup-emptydir"
|
||||
fn_run_cmd "rsync -a --delete /tmp/rsync-time-backup-emptydir/ '$DIR'"
|
||||
fn_run_cmd "rm -rf -- /tmp/rsync-time-backup-emptydir '$DIR'"
|
||||
else
|
||||
fn_log_error "Trying to delete a directory that either does not exist or is not a directory: $DIR"
|
||||
fi
|
||||
}
|
||||
|
||||
fn_touch() {
|
||||
fn_run_cmd "touch -- '$1'"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue