Skip to content

Instantly share code, notes, and snippets.

@rodriigomedeiros
Created May 22, 2017 18:30
Show Gist options
  • Save rodriigomedeiros/8a57e3be65ef38aecebb6e815985163b to your computer and use it in GitHub Desktop.
Save rodriigomedeiros/8a57e3be65ef38aecebb6e815985163b to your computer and use it in GitHub Desktop.
Remove suffix in files from a directory
find . -maxdepth 1 -regex '.*_suffix.jpg' -print0 | \
while read -d '' -r; do
[[ $REPLY =~ $regex ]] && mv "$REPLY" "${BASH_REMATCH[1]}.jpg"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment