Skip to content

Instantly share code, notes, and snippets.

@imabuddha
Created January 28, 2010 04:47
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 imabuddha/288438 to your computer and use it in GitHub Desktop.
Save imabuddha/288438 to your computer and use it in GitHub Desktop.
get new go games & rename files
#!/bin/bash
# great src url: http://igo-kisen.hp.infoseek.co.jp/topics.html
SGF_SRC_LISTUsers/adrian/Go/Games/TWIG/urls.txt
SCRATCH_DIRtmp/twig
DESTINATION_DIRUsers/adrian/Go/Games/TWIG
mkdir $SCRATCH_DIR
cd $SCRATCH_DIR
if [ "$1" != "--process-only" ]
then
wget -r -l inf -t1 -nd -N -np -A.sgf -erobots=off -i "$SGF_SRC_LIST"
fi
if [ "$1" != "--download-only" ]
then
for sgfFile in $SCRATCH_DIR/*.sgf
do
pw=`mdls -raw -name com_breedingpinetrees_sgf_white "$sgfFile"`
pb=`mdls -raw -name com_breedingpinetrees_sgf_white "$sgfFile"`
dt=`mdls -raw -name com_breedingpinetrees_date_played "$sgfFile"`
dt{dt:0:10}
echo $dt-$pw-$pb
dest="$DESTINATION_DIR/$dt-$pw-$pb.sgf"
if [ -e "$dest" ]
then
# Do nothing
echo "Skipping $sgfFile"
else
#cp -v "$sgfFile" "$dest"
echo "Skipping $sgfFile"
fi
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment