Skip to content

Instantly share code, notes, and snippets.

@moofkit
Created February 9, 2023 15:19
Show Gist options
  • Save moofkit/dfe70285de51df4aba81ed8d758ca55b to your computer and use it in GitHub Desktop.
Save moofkit/dfe70285de51df4aba81ed8d758ca55b to your computer and use it in GitHub Desktop.
Rename files with patterns in bash
$find . -depth -name "*old.txt" -exec sh -c 'f="{}"; mv -- "$f" "${f%old.txt}new.csv"' \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment