Skip to content

Instantly share code, notes, and snippets.

@SalvadorP
Created June 21, 2022 06:42
Show Gist options
  • Save SalvadorP/a683eb9504d3af9fad92ca37a7574751 to your computer and use it in GitHub Desktop.
Save SalvadorP/a683eb9504d3af9fad92ca37a7574751 to your computer and use it in GitHub Desktop.
Rename files based on pattern
#!/bin/bash
# Renames all files in the actual directory.
# Searches for first parameter then changes for the second.
for f in *; do mv "$f" "$(echo "$f" | sed s/$1/$2/)"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment