Created
October 12, 2012 11:47
-
-
Save daemonza/3878849 to your computer and use it in GitHub Desktop.
Script to make uploads of tcx files from garmin connect easier
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
#!/usr/bin/env bash | |
# Copy the script into the directory where all your tcx files | |
# are located. Run it and then upload to Stava from the upload directory. | |
# Coded by Werner Gillmer <[email protected]> | |
echo "Creating sorting directories" | |
nrFiles=`ls -l ./*.tcx | wc -l` | |
nrDirs=$(($nrFiles/24)) | |
counter=0 | |
while [ $counter -lt $nrDirs ]; do | |
let counter=counter+1 | |
mkdir -p "./upload/$counter" | |
nrFiles=0 | |
while [ $nrFiles -lt 24 ]; do | |
echo "Current count is $nrFiles" | |
fileToMove=`ls ./*.tcx | head -1` | |
echo "Moving ./$fileToMove to ./upload/$counter" | |
mv "./$fileToMove" ./upload/$counter/ | |
let nrFiles=nrFiles+1 | |
done | |
done | |
# Clean up of the last couple of tcx | |
# files into sorting dir. | |
oneMoreDir=$(($nrDirs+1)) | |
mkdir ./upload/$oneMoreDir | |
mv ./*tcx ./upload/$oneMoreDir | |
echo "done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
❤️