Skip to main content
3 of 3
edited tags
Gilles 'SO- stop being evil'
  • 865.3k
  • 205
  • 1.8k
  • 2.3k

Batch renaming of files

I have a directory full of images:

DSCN4749.JPG
DSCN4750.JPG
DSCN4892.JPG
...

And I would like a one-liner to rename them to (say).

dscn4749.jpg
dscn4750.jpg
dscn4892.jpg
...

How do I do this?

Alternatives/extenstions/caveats

  • I want to recurse
  • The directory contains a mix of file types I only want to rename DSCN*.JPG files.
  • bash solution
  • perl solution
  • zsh solution
  • I want a new directory tree with hard links existing files.
  • I want to change name more than just a case change eg dscn5555.JPG to 05555.jpg

...

X Tian
  • 10.7k
  • 3
  • 35
  • 51