Created
July 21, 2017 15:29
-
-
Save Bueddl/0ec097c126fd338cb396493c8ea3c3da to your computer and use it in GitHub Desktop.
Sort ManiaPlanet maps into folders by titlepack
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
find . -type f -iname '*.Gbx' -print0 | | |
while IFS= read -r -d $'\0' file; do | |
title=$(grep -aPo 'title="(.*?)"' "$file" | sed -r 's/.*?="(.*)"/\1/g') | |
titledir="repack/$title" | |
if [ ! -d $titledir ]; then | |
mkdir -vp $titledir | |
fi | |
filename=$(basename "$file") | |
cp -v "$file" "$titledir/$filename" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment