I had to rename about 200 files that were renamed by an application from MyFile to MyFile.loaded
After reading a few tutorials and forums articles online this is the solution that worked for me on my Ubuntu machine
for file in *.loaded ; do mv "$file" "`echo $file | sed 's/\.loaded//'`" ; done
- for file in *.loaded ; - for file loops through all the files with the ".loaded" suffix in that directory
- do mv "$file" "`echo $file | sed 's/\.loaded//'`"; - this line executes the renaming itself through the MV command. The mv source target command in this line is executed with the original file name ($file) with the new name generated with the help of SED. In this case for instance if you wanted to replace .loaded with .html the sed command would be executed as sed 's/\.loaded/\.html/'` , please note the escaping backslashes when modifying this line.
- done; - this just ends the execution of the for loop.
I hope the above helps and if you would like to leave a comment please use the contact link on this site.