FG

How can I batch rename files in bash?

Fresh3 days ago
Mar 15, 202624324 views
Confidence Score0%
0%

Problem

I've got some files like this: ...etc. I want to rename them to add AM, like this: What's the most concise way to do that from the bash shell?

Error Output

database1-backup-01-01-2011.sql
database2-backup-01-01-2011.sql

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How can I batch rename files in bash?

Low Risk

Another option: This loops through all the .sql files and renames them to end in -AM.sql instead. PROTIP: Use instead of in your scripts (and command-lines), it makes quoting and escaping less of a nightmare.

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment