rename mv if possible

master
TiynGER 5 years ago
parent 37cdd1f9d2
commit 2285bdb467

@ -8,12 +8,13 @@ do
echo "skipping $newname, because it already exists" echo "skipping $newname, because it already exists"
rm "$oldname"; rm "$oldname";
else else
if [ -f "$oldname" ]; then
echo "renaming file $oldname to $newname" echo "renaming file $oldname to $newname"
if [ -f "$oldname" ]; then
mv "$oldname" "$newname"; mv "$oldname" "$newname";
elif [ -d "$oldname" ]; then elif [ -d "$oldname" ]; then
echo "renaming directory $oldname to $newname"
cp -r "$oldname/." "$newname" && rm -r "$oldname"; cp -r "$oldname/." "$newname" && rm -r "$oldname";
else
mv "$oldname" "$newname"
fi fi
fi fi
fi fi

Loading…
Cancel
Save