1
0
mirror of https://github.com/tiyn/dotfiles.git synced 2025-03-27 21:47:46 +01:00

rename mv if possible

This commit is contained in:
TiynGER 2020-02-27 14:14:29 +01:00
parent 0cbce384be
commit 289a1c29be

View File

@ -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