I’ve just very recently switched to Linux and I want to change a load of files to have different extensions. For example I want to change .doc/docx to .txt and images to .jpg and so on. Is there a csh script that would cover any extension or would I have to write a new one for each filetype.
I have this so far, but I’m not sure if it will actually work. Any help is much appreciated!
#!/bin/bash
for f in *.$1
do
[ -f "$f" ] && mv -v "$f" "${f%$1}$2"
done
That would do the rename; keep in mind that renaming a Word document won’t cause it to become text, though.