brainchild1977
Programmer
I need to rename files by changing only the file extension (retain the filename) using a for loop. i found this piece of code online
OLDPREFIX=aaa
NEWPREFIX=bbb
for FILE in "$OLDPREFIX"*
do
NEWNAME=´echo "$FILE" | sed -e "s/^${OLDPREFIX}/$NEWPREFIX/"´
mv "$FILE" "$NEWNAME"
done
But when i run the code, i get an error saying "cannot access aaa" any ideas why?
Let me know if you have a simpler way of doing this?
OLDPREFIX=aaa
NEWPREFIX=bbb
for FILE in "$OLDPREFIX"*
do
NEWNAME=´echo "$FILE" | sed -e "s/^${OLDPREFIX}/$NEWPREFIX/"´
mv "$FILE" "$NEWNAME"
done
But when i run the code, i get an error saying "cannot access aaa" any ideas why?
Let me know if you have a simpler way of doing this?