This is just a reminder to myself how to rename files by removing a suffix. The typical scenario is that I have just renamed a bunch of files, by adding the suffix
.bak or something like that. Now I want to rename the files to their original name by removing
.bak.
For example to rename all files matching *.conf.bak so that just have the .conf-suffix:
for i in $(ls *.conf.bak); do mv -f $i ${i%.conf.bak}.conf; done;
Comments
Post new comment