I'm using Windows98 on my home PC. I have a collection of Video CDs (VCD) of recent movies.

Yesterday I discovered that a CD has been badly scratched near the end.. I tried to watch it to see what happens, near the end of the movie (at the credits) the computer crashes.

I tried to copy it to the hard drive, to burn it on a new CD, but the copy fails at 99% ; Windows fails to copy the last 10 Kb of the file and messages an error, without closing the file...

I had to save the remaining data of the file, so I ran to perl;

#!perl -w open READ, 'f:\mpegav\avseq01.dat'; binmode (READ); open WRITE, ">c:\CD\scream3.dat"; binmode (WRITE); # If the file read fails, the script won't die, the eval # just fails, and I can close the file. :) eval { while (<READ>) { print WRITE $_; print tell (READ) ," bytes\n"; # just to see some action on the sc +reen. } }; close (WRITE); close (READ);

Not very much of a smart code, but it saved my movie...

now what would have happened if the scratch was in the middle of the file???


He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.

Chady | http://chady.net/

In reply to Saving the VCD by Chady

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.