Renaming Multiple Files with zsh

2010-05-05

Problem: Before further processing them you have to rename a bunch of files in the form of forename surname.png to surname_forename.png.

Solution: One fast way to solve this is to use the zmv function of your Z shell. The only prerequisite is to make sure zmv is loaded either by executing autoload zmv interactively or from within yout zsh configuration.

To rename the files use zmv '(*) (*).png' '$2_$1.png'.

A good starting point for learning more about the zmv function is the zshcontrib manpage.

Post to Twitter

Comments

Pingback from http://wolke23.at » Adding Leading Zeros to Filenames
Time August 6, 2010 at 06:16

[...] in May I did a blog post about how to batch rename files with Zshell's zmv function. Today I will use zmv to add leading zeros to filenames, so that 1.pdf, [...]