Automatically restore files from lost+found

Gestern war ich gut unterwegs in Rostock. Ich wollte nämlich ein Wii Fit für die Wii, die es zu Weihnachten gab, käuflich erwerben.
Eigentlich hatte ich das Wii Fit Board ja schon Anfang Januar bei Amazon bestellt. Die können aber derzeit nicht liefern. Ausverkauft.
Also dachte ich, daß die hiesigen “Wir-sind-doch-bloed-und-kaufen-teuer-ein-obwohl-die-Werbung-anderes-suggeriert”-Märkte der Metro-Gruppe mir da nun langsam mal aus dem Schlamasseln heraushelfen könnten. Denn dort gibt es ja immer alles und das natürlich supergünstig.
Also führte mich mein erste Weg in den MediaMarkt in Bargeshagen. Nachdem ich zwar zahlreiche Wiis, Wii-Remotes, Wii-Wheels, Wii-Ladegeräte entdeckt hatte, beschlich mich ja schon ein leiser Verdacht. Aber sicher ist sicher und wer nicht fragt bleibt dumm. Also jemanden gesucht, der mir mutmaßlich weiterhelfen könnte: gleich um die Ecke stand jemand der fleissig Pakete ins Regal packte. Die wenig freundliche Antwort gebe ich hier mal nicht wider. Kann man sich ja eh schon denken. Also noch nach einem richtigen Verkäufer gesucht und nicht nur nach einem Regaleinräumer. Nachdem einer gefunden war, wußte ich: keine Wii Fits da und wann welche kommen sollen, weiß auch niemand so recht. Alles ausverkauft. Ach?

Naja, also dachte ich mir, daß ich mein Glück beim Pro-Markt versuche. Ich brauchte eh noch eine Druckluftdose, um meine Rechner zu entstauben. Aber auch da weit und breit nichts von einer Wii Fit zu sehen. Die Druckluftdose fuer ca. € 12.- hab ich auch dort stehen gelassen, da ich mich erinnerte, daß es im Marktkauf die gleiche für ca. € 10,- gibt.

Und da ich schonmal auf der völlig anderen Seite von Rostock war, dachte ich mir, daß ich ja nochmal im zweiten MediaMarkt vorbeischauen könnte. Vielleicht hab ich ja dort Glück? Aber dem war leider nicht so. Auch dort ausverkauft und keine Ahnung, wann Nachschub kommt.

Als letztes wagte ich mich dann noch todesmutig in die Innenstadt, ohne aber in ein Parkhaus zu fahren. Bei Saturn soll es ja auch alles geben und alles günstig sein – nur halt eben kein Wii Fit Board, wie ich feststellen mußte. Insofern stimmte die Werbeaussage: selten soviel Geld gespart.

Achja, die Druckluftdose hab ich dann aus dem Saturn mitgenommen: für € 9,99.

Vielleicht gibt es ja Mitte bis Ende Februar neue Wii Fits. Aber – und das ist etwas, was ich nebenbei auch erfahren habe, als ich mich nach einem Festbrennweitenobjektiv für die D90 umgeschaut habe – die Japaner erhöhen derzeit aufgrund des starken Yen alle Preise. Mal schauen, was das dann für das Wii Fit Board bedeutet… *sigh*

Uncategorized

6 thoughts on “Automatically restore files from lost+found

  1. The problem is that the data structure you're using is horribly slow for this purpose. You could speed it up *tremendously*by using a prefix tree. Of course, since you want to keep bash, we'll have to resort to a simpler version.
    Basically, you're going to put 16 ls-md5sum-files.txt files: ls-md5sum-files-1.txt, …, ls-md5sum-files-f.txt.
    At build time, sort your hashes according to the first letter of the hash into these files. Same at grep time.
    This should speed-up your search by a 16x factor. You can divide them according to the 2 first letters, giving you a 256x speed-up, and so-on.

  2. How about extending rdiff-backup or one of the other backup tools to do something similar?

  3. I don't have time to test this, but what about placing the md5 at the start of each line, sorting the files, then stepping through both files a line at a time finding and moving matches along the way.

    It just depends whether 2 sorts would be quicker than grepping the file each time.

  4. Load the hashes in a perl HASH like so:

    find -type f -print0 |
    xargs -0 openssl sha1 |
    perl -ne '
    sub parsesha1{
    $sha1=substr($_,-41,40);
    $filename=substr($_,5,-44)
    }
    &parsesha1;
    $file_hashes{$sha1}=$filename;

    END{
    foreach $hash (keys %file_hashes){
    print “$hash:”,$file_hashes{$hash},”

    }
    } '

  5. The thing is Bash really sucks handling spaces in arrays (which is what you do with the “for file in $filelist” construct). Don't do it, plus I don't think there is a hash table in bash, of course you can make your own….

    Use perl instead, as I said before, or what would take even less time to code is to use python pickle to store the the hash + files in a machine readable format, then just load it when you start up again.. I haven't done this myself but I've seen it done and it seem trivial and a good thing to learn.

Comments are closed.