From 289a1c29be4f3815f4ce14dee25078e79e032fd1 Mon Sep 17 00:00:00 2001 From: TiynGER Date: Thu, 27 Feb 2020 14:14:29 +0100 Subject: [PATCH] rename mv if possible --- .local/bin/etc/cleanname | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.local/bin/etc/cleanname b/.local/bin/etc/cleanname index 950ea13..41e3672 100755 --- a/.local/bin/etc/cleanname +++ b/.local/bin/etc/cleanname @@ -8,12 +8,13 @@ do echo "skipping $newname, because it already exists" rm "$oldname"; else - if [ -f "$oldname" ]; then echo "renaming file $oldname to $newname" + if [ -f "$oldname" ]; then mv "$oldname" "$newname"; elif [ -d "$oldname" ]; then - echo "renaming directory $oldname to $newname" cp -r "$oldname/." "$newname" && rm -r "$oldname"; + else + mv "$oldname" "$newname" fi fi fi