Skip to content

Instantly share code, notes, and snippets.

@cgoldberg
Created October 8, 2018 21:54
Show Gist options
  • Save cgoldberg/5e9e165487c977ecfb6cb2c82289b9d2 to your computer and use it in GitHub Desktop.
Save cgoldberg/5e9e165487c977ecfb6cb2c82289b9d2 to your computer and use it in GitHub Desktop.
shell one-liner - rename files in current directory with digits stripped from filenames
# rename files in current directory with digits stripped from filenames
# first do a dry-run (only print the commands that will be applied)
for f in *; do echo mv "$f" $(printf '%s' "$f" | tr -d '0123456789'); done
# run it for real (modifications done in-place)
for f in *; do mv "$f" $(printf '%s' "$f" | tr -d '0123456789'); done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment