Created
November 6, 2017 23:49
-
-
Save chaicko/38ab786282255707581e35833bf90521 to your computer and use it in GitHub Desktop.
Bash recipes
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 | |
# Rename a bunch of files by removing the last 2 characters of the filename (not the extension) | |
for f in *.*; do fname=${f%.*}; extension=${f##*.}; mv $f ${fname%??}.${extension}; done | |
# How? use bash substituions http://www.tldp.org/LDP/abs/html/parameter-substitution.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment