I have a bunch of files with names like

... (Karton 1).jpeg

and would like to rename them recursively to:

... (brauner Karton).jpeg

I tried the following commands, which didn't work:

rename -v 's/Karton 1/brauner Karton/g' *
rename -v 's/Karton 1/brauner Karton/g' *.jpeg

According to a lot of examples this shouldn't be that hard. What am I doing wrong?

Aditional info: "Karton 1" would be "[B/b]ox 1" in English.

closed as off-topic by user68186, dessert, karel, user117103, αғsнιη Apr 14 '18 at 16:59

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This describes a problem that can't be reproduced, that seemingly went away on its own or was only relevant to a very specific period of time. It's off-topic as it's unlikely to help future readers." – user68186, dessert, karel, guntbert, αғsнιη
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    What exactly happened? Was there any output? You may be using the wrong rename... You don't need to escape spaces in regex, btw. Also, please show your real filenames - do not add quotes, . characters etc that are not really there! – Zanna Apr 14 '18 at 12:48
  • Version is 2.31.1 (util-linux). – Markus Apr 14 '18 at 12:58
  • Try rename -n ... first. What does it show? – PerlDuck Apr 14 '18 at 13:02
  • No output. Also not with rename -n -v – Markus Apr 14 '18 at 13:11
  • 2
    rename.ul is the wrong rename for this syntax. You need Perl rename (file-rename). Are you using Ubuntu? – Zanna Apr 14 '18 at 13:14

There are several versions of the rename command. Use rename --version to determine which you have, they use different syntax.

$ rename --version
/usr/bin/rename using File::Rename version 0.20
$ rename 's/\.jpeg$/.jpg/' *

$ rename --version
rename from util-linux 2.30.2
$ rename .jpeg .jpg *
  • I think you and the OP are talking about different utilities. And wonder which one he actually has. – PerlDuck Apr 14 '18 at 13:07
  • 1
    He's got the one I have. Mine is util-linux 2.30.2, I ran into this issue a year ago and couldn't figure out how to get rename to work again...if I had only looked at the man page. – rtaft Apr 14 '18 at 13:11
  • 1
    Ok. Because there's also one with his syntax. – PerlDuck Apr 14 '18 at 13:12
  • I know, I used to use it, trying to figure out when/why that changed. – rtaft Apr 14 '18 at 13:13

Not the answer you're looking for? Browse other questions tagged or ask your own question.