Batch rename files

When renaming a number of files at the same time, it is more convenient to use a GUI for the job. Métamorphose is one such program that does the job brillianty, and freely. There are others Flash Renamer was another (not free) great program. However, sometimes it is fun to do the same stuff using command-line. Below are a couple of ways to do batch renaming.



1. When deleting certain amount of characters from the start of the filename, use:
for i in *;do L="${i:16}"; mv $i "${L}"; done
The above takes all the files in the current folder, removes the first 16 characters, and moves the files with the new names.

2. When replacing a character (e.g., a space) anywhere in the filename, with something else (e.g., underscore), use the following:
for file in *; do mv -v "$file" "$(sed 's/ /_/g' <(echo $file))"; done

Popular posts from this blog

Künefe Tarifi

Bir Word Belgesinde Kapak Harici Kaç sayfa Olduğunu Bulmak