Dave's Brain

Browse - Programming Tips - How can I rename a bunch of files to lowercase?

Date: 2014oct26
Product: mmv
Language: bash
OS: Linux

Q.  How can I rename a bunch of files to lowercase?
eg all .jpg's in a folder.

A.  This can be done by writing a fairly short shell script.
But quickly hacked together scripts often don't handle edge cases like
spaces in filenames, I/O errors, disk full etc.
There is a command that can do it and I recommend using it.
For example, rename all .JPG's to lowercase:

	mmv \*.JPG \#l1.jpg
	             ^ 
	             The l means lowercase (use u for uppercase)

	     ^^^^^^ Pattern of files to select

See its man page for more info.

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.