Replace ACDC to AC-DC
For example we have these files
ACDC - Rock N' Roll Ain't Noise Pollution.xxx
ACDC - Rocker.xxx
ACDC - Shoot To Thrill.xxx
I want them to become:
AC-DC - Rock N' Roll Ain't Noise Pollution.xxx
AC-DC - Rocker.xxx
AC-DC - Shoot To Thrill.xxx
I know that sed or awk is used for this operation. I can't google anything so I'm asking for your help =) Could you please provide full working shell command for this task?
Feedback: Solution for OSX users
from
man rename
For example, to rename all files matching "*.bak" to strip the extension, you might say
To translate uppercase names to lower, you'd use
This answer contains the good parts from all other answers, while leaving out such heresy as
ls | while read
.Current directory:
Including subdirectories:
Newline characters are really unlikely to be in filenames, so this can be simpler while still working with names containing spaces:
To use the util-linux version of
rename
that Phil referred to (on Ubuntu, it's calledrename.ul
):or
Using the bash shell
Note: using
find
will process the current directory, and the directories under.Depends on your shell. In zsh, I'd do this:
Probably not the best solution, but works.
Using bash:
If you have the
rename
program installed: