Skip to content

Instantly share code, notes, and snippets.

@Bueddl
Created July 21, 2017 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Bueddl/0ec097c126fd338cb396493c8ea3c3da to your computer and use it in GitHub Desktop.
Save Bueddl/0ec097c126fd338cb396493c8ea3c3da to your computer and use it in GitHub Desktop.
Sort ManiaPlanet maps into folders by titlepack
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