Created
May 6, 2012 11:55
-
-
Save gavinheavyside/2621887 to your computer and use it in GitHub Desktop.
strip colons from filenames in an extracted report tarball
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
# If you just want to rename already-unzipped files | |
for f in `find . -type f -name "*:*"`; do mv $f `echo $f | sed 's/\([0-9]\{4\}\)-\([0-9]\{2\}\)-\([0-9]\{2\}\)T\([0-9]\{2\}\)\:\([0-9]\{2\}\)\:\([0-9]\{2\}\)Z/\1\2\3\4\5\6/g'`; done |
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/bash | |
pushd $1 | |
unzip raw-data.zip | |
for f in `ls raw-data`; do | |
newname=`echo -n $f | sed 's/\([0-9]\{4\}\)-\([0-9]\{2\}\)-\([0-9]\{2\}\)T\([0-9]\{2\}\)\:\([0-9]\{2\}\)\:\([0-9]\{2\}\)Z/\1\2\3\4\5\6/g'` | |
mv raw-data/$f raw-data/$newname | |
done | |
rm raw-data.zip | |
7z a -r raw-data.zip raw-data | |
rm -r raw-data | |
unzip google-earth.zip | |
for f in `ls google-earth`; do | |
newname=`echo -n $f | sed 's/\://g'` | |
mv google-earth/$f google-earth/$newname | |
done | |
rm google-earth.zip | |
7z a -r google-earth.zip google-earth | |
rm -r google-earth | |
popd |
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
# from the top level of an extracted report tarball | |
$ find . -type d -depth 1 | xargs -I {} ./filename_fixer.sh {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment