thiagowfx's avatar

Β¬ just serendipity πŸ€ (not just serendipity)

Rename files in bulk

β€’ 71 words β€’ 1 min β€’ updated

⚠️ This post is over one year old. It may no longer be up to date or relevant. Opinions may have changed.

Whenever the files are in the same directory, vidir from moreutils is the best interactive tool.

If files are scattered across multiple directories, consider using the rename utility from util-linux.

A simple example to rename all readme.md files to README.md for consistency:

shell
rename 's/readme\.md/README.md/' **/*

A more recent example (2024-07-25):

shell
rename 's/promtail-global-testing/promtail-global/g' **/*

If there are nested directories that match the expression, you’ll need to run rename multiple times.