Skip to main content
Removed typo.
Source Link
user218374
user218374

Your approach on the right track, just needs some accuracy. You could do this:

for file in ./*.png; do  mv  "$file"  "${file%%.png-*}";.png";  done

Please note that there was a typo in the comment section: ./*.png this will eat up the whole of the ${file%%.png} expression :<

Your approach on the right track, just needs some accuracy. You could do this:

for file in *.png; do mv "$file"  "${file%%.png}"; done

Please note that there was a typo in the comment section: ./*.png this will eat up the whole of the ${file%%.png} expression :<

Your approach on the right track, just needs some accuracy. You could do this:

for file in ./*.png; do  mv  "$file"  "${file%%-*}.png";  done
Source Link
user218374
user218374

Your approach on the right track, just needs some accuracy. You could do this:

for file in *.png; do mv "$file"  "${file%%.png}"; done

Please note that there was a typo in the comment section: ./*.png this will eat up the whole of the ${file%%.png} expression :<