Posted By

jarnaldich on 09/01/10


Shell unix rename

Versions (?)

Batch rename with wildcard support in Unix

 / Published in: Bash

To rename a bunch of files from ".foo" to ".bar" (like windows' REN *.foo *.bar) in unix.

Looking at the solution, it is easy to adapt it to more powerful character substitutions on a 1 to 1 basis.

If you want to test what will be executed before doing so, just drop the last pipe.

  1. ls -d *.foo | sed -e 's/.*/mv & &/' -e 's/foo$/bar/' | sh

Report this snippet  

You need to login to post a comment.