Created
January 20, 2014 19:42
-
-
Save bortels/8527587 to your computer and use it in GitHub Desktop.
Backup my jailbroken iPad nightly to my unix box
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/perl | |
# Backup ipad app Documents folders in a sane manner | |
# Expects public key login (ie. no password) as user "mobile" | |
$dest = '/backups/ipaddocs'; | |
$find = 'find ./ -maxdepth 2 -name "*.app" -type d'; | |
$appdir = '/private/var/mobile/Applications'; | |
open (I, "ssh -n mobile\@192.168.1.86 'cd $appdir ; $find' |"); | |
# Example output: ./F2C36A80-4F02-404F-B589-48362E6A6F52/Tiny Wings HD.app | |
while (<I>) { | |
@r = split(/\//); | |
$hash = $r[1]; | |
$name = $r[2]; | |
$name =~ s/.app\n$//; | |
$name =~ s/[^\w]/_/cg; | |
$DB{$hash} = $name; | |
} | |
$total = scalar(keys %DB); | |
$n=0; | |
foreach (keys %DB) { | |
$n++; | |
print "===== $n of $total : $DB{$_}\n"; | |
$hash = $_; | |
$name = $DB{$hash}; | |
system("mkdir -p $dest/$name-$hash"); | |
system("rsync -avz --progress mobile\@192.168.1.86:$appdir/$hash/Documents $dest/$name-$hash"); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment