Created
November 12, 2019 07:48
-
-
Save jacob-faber/b9dd2e2099a731dc781af862215feed6 to your computer and use it in GitHub Desktop.
Google Takeout Merge Tool: Unzips and merges all your exported data into a single folder
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 | |
destDir="../Takeout-merge" | |
mkdir -p $destDir | |
# Merges the different unzipped Takeout folders into one | |
for p in $(seq -f "%03g" 1 ${1:-1}); do | |
if [ -f $p/DONE ]; then | |
echo "Skipping $p/Takeout ... " | |
continue | |
fi | |
echo "Merging $p/Takeout into {$destDir} ... " | |
# t = preserve modification times | |
# q = quiet, suppress non-error messages | |
# r = recursive on folders | |
# X = preserved extended attributes | |
# X = skip files which are newer in dest than in src | |
# h = output numbers in a human-readable format | |
rsync -rtXhu --info=progress2 --safe-links --remove-source-files $p/Takeout {$destDir} | |
touch "$p/DONE" | |
echo "DONE merging $p" | |
done | |
echo "ALL MERGED!" |
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 | |
# Unzips all Takeout archive files (living in the same dir) | |
archiveTimestamp=${2:-"20000101T100000Z"} | |
for p in $(seq -f "%03g" 1 ${1:-1}); do | |
f="takeout-${archiveTimestamp}-$p.tgz" | |
if [ -f $f ]; then | |
echo "Archive not found: $f. Skipping ... " | |
continue | |
fi | |
mkdir -p $p | |
cd $p | |
echo "Unzipping takeout-${archiveTimestamp}-$p.tgz ..." | |
tar -zxf "takeout-${archiveTimestamp}-$p.tgz" | |
echo "DONE unzipping $p" | |
cd .. | |
done | |
echo "ALL UNZIPPED!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice 👍