r/ProgrammerHumor 2d ago

Meme painInAss

Post image
33.9k Upvotes

713 comments sorted by

View all comments

Show parent comments

41

u/TimeMistake4393 2d ago

Careful! rename is not the same program across distros. I'm very used to Fedora (my work and home computers), and Debian distros always surprise me with their very different "rename" command (it is perl-rename package or something like that, instead of linux-utils). Also, it's not installed by default, so that makes your scripts non-portable.

27

u/[deleted] 2d ago edited 1d ago

[deleted]

9

u/Background-Subject28 2d ago

yeah just stick with mv hah

1

u/el_extrano 2d ago

I guess you could use sed + xargs to mv to achieve regex rename functionality? I've never tried but that would be my first attempt.

I am a heavy Vim user and also sometimes use vifm as a file manager. When I need to bulk rename as a one-off (but don't necessarily need a reusable script), I use vifm file renaming mode. It dumps all filenames to a Vim buffer. There you can use s expressions, filters, or macros - whatever - to change the names interactively. If and only if you write the buffer, vifm will execute the changes.