Last active
December 13, 2018 03:11
-
-
Save nooptr/f927e8d4f58c686a511e3ba72ac99f55 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ex: rename file test.jpg?w=12&h=15 to test.jpg | |
for FILE in *; do mv $FILE ${FILE%\?*}; done | |
# tham khao: | |
# https://unix.stackexchange.com/questions/33279/how-can-i-rename-multiple-files-by-removing-a-character-or-string | |
# ${i%-*} matches the begining of the filename up to the last occurrence of the dash - | |
# ${file##*-} matches the rest of the filename after the last occurrence of the dash - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment