Skip to content

Instantly share code, notes, and snippets.

@andrey-zakharov
Last active September 10, 2021 11:41
Show Gist options
  • Save andrey-zakharov/3409673eb41706b7f89337c7fca1222b to your computer and use it in GitHub Desktop.
Save andrey-zakharov/3409673eb41706b7f89337c7fca1222b to your computer and use it in GitHub Desktop.
bash mass batch rename
find -name OLDNAME\*png
| sed -E 's#.*STUFFTOREMOVE([0-9]+)(.*)\.png$#\0 newfancyname-\2/named_\1_art.webp#g'
| while read orig dest; do
convert $orig -write ~/some/destination/$dest; done
# convert png to webp
find -name \*png | while read p; do convert $p -write src/main/res/${p%.png}.webp; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment