/usr/bin/pilot-undelete is in pilot-link 0.12.5-4ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | #!/usr/bin/perl
use PDA::Pilot;
use Getopt::Std;
$opts{p} = $ENV{PILOTPORT} if length $ENV{PILOTPORT};
if (not getopts('p:d:',\%opts) or not exists $opts{p} or not exists $opts{d}) {
print "Usage: $0 -p port -d dbname\n";
print "\n $0 will scan through dbname on your Pilot and turn all archived\n";
print " records into normal records, thus \"undeleting\" them.\n";
exit;
}
$socket = PDA::Pilot::openPort($opts{p});
print "Please start HotSync on port $opts{p} now.\n";
$dlp = PDA::Pilot::accept($socket);
if (defined $dlp) {
print "\nConnection established. Opening $opts{d}...\n";
$dlp->getStatus;
$db = $dlp->open($opts{d}, "rwsx");
if (defined $db) {
print "\nDatabase opened.\n";
$i = 0;
$c = 0;
for(;;) {
$r = $db->getRecord($i);
last if not defined($r); #no more records
if ($r->{archived}) {
print "Record $i is archived, un-archiving.\n";
$r->{archived} = 0;
$r->{deleted} = 0;
$db->setRecord($r); # Re-store record
$c++;
}
$i++;
}
$db->close;
print "Done. $c record", ($c == 1 ? "" : "s"), " unarchived.\n";
} else {
print "Unable to open database\n";
}
$dlp->close;
}
PDA::Pilot::close($socket);
exit(0);
|