Created
November 6, 2023 06:56
-
-
Save mattpetters/f3fccac80683a4526539b4cb8710d158 to your computer and use it in GitHub Desktop.
Script to remove prefixes from Ableton stem exports -- usage: ./rename_stems.sh "MY_PROJECT PREFIX ABCDEF"
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/zsh | |
# Check if an argument was provided | |
if [ $# -eq 0 ]; then | |
echo "Usage: $0 prefix" | |
exit 1 | |
fi | |
# Prefix to be removed (first argument) | |
PREFIX="$1" | |
# Store the directory where the script is located | |
SCRIPT_DIR=$(dirname "$0") | |
# Change to the directory where the script is located | |
cd "$SCRIPT_DIR" || exit | |
# Loop through all .wav files with the specified prefix | |
for file in ${PREFIX}*.wav; do | |
# Remove the prefix from the file name | |
newname="${file#${PREFIX}}" | |
# Rename the file | |
mv -- "$file" "$newname" | |
done | |
echo "Renaming complete." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment