Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Perl Files Corrumpted

by virtualweb (Sexton)
on Jan 26, 2010 at 18:16 UTC ( [id://819733]=perlquestion: print w/replies, xml ) Need Help??

virtualweb has asked for the wisdom of the Perl Monks concerning the following question:

Hi:

This is not about code but about how to save de code on perl files which I accidently deleted, so if my question needs to be moved to another section, please do and forgive me.

I virus recently infected my hard drive. I backed up my files burning a DVD. Then I sent all my files to the Trash Bin in my Windowe PC, and then deleted them.

After reformatting and reinstalling Windows XP, plus installing Active Perl and the Xitami Linux server, (where I develop my perl), I grabbed my DVD BackUp to re-install my scripts in the cgi-bin, but much to my surprice the DVD had only the name of the folder burned in it and not its contents. My folder which supposedly contained the perl scripts was empty and the files where gone.. or never burned.

Searching through the internet I found file recovery software which helped me find all the files that I was missing and exported them out of my main hardrive into a USB memory.

When opening those perl files with a code editor now I dont see my code but the mess you normally see when you accidently transferred a perl file in binary mode.

Does anyonme know if there is any hope in repairing these files, so I can continue development..??

Thanx beforehand
virtualweb

Replies are listed 'Best First'.
Re: Perl Files Corrumpted
by kikuchiyo (Hermit) on Jan 26, 2010 at 19:03 UTC
    I'm sorry, but based on what you've described, those files may have been irrecoverably overwritten.

    That "recovery software you found on the internet" may or may not have found the original physical locations of the files in question, however, those locations were overwritten by the files of the newly installed operating system. The recovery software just copied whatever it has found on those locations to your USB drive - but the contents of those "recovered" files are most likely junk, originally parts of some system file. They don't have any relation with your original, pre-format files, you can't recover your original data from them.

    There are some professional data recovery firms that deal with cases like this; they may get back some of your data for $10000s.

    Fully recovering data from an overwritten hard drive - I don't think anyone but the NSA can do that.
Re: Perl Files Corrumpted
by ikegami (Patriarch) on Jan 26, 2010 at 18:31 UTC

    When opening those perl files with a code editor now I dont see my code but the mess you normally see when you accidently transferred a perl file in binary mode

    What does that mean? Using FTP's binary mode (between non-EBCDIC systems), the worse that will happen is the line endings getting messed up. Is that what you mean?

    Care to give a dump of a portion of the file? Maybe something like

    od -c file | head -30

      Indeed, dropping the "\r" from the traditional Win32 line ending of "\r\n" means that Notepad.exe (and others of the more stupid Win32 programs) don't recognize the bare "\n" as a real line ending. So you get all of the code run together in one big line that looks quite like an unintelligible mess.

      My first suggestion would be to get a better editor. But restoring the line endings to "\r\n" is pretty easy. If you have (a native) Perl on Win32, then you can do that as simply as:

      perl -pi-i -e "BEGIN{@ARGV=map{glob}@ARGV}" *.pl REM check the new *.pl file contents REM if everything looks good, then: del *.pl-i

      Guru meditation

      - tye        

        You can also do that with nothing more than Wordpad from Windows Progams->Accessories. It will display the file properly. If you hit the save button, it will save the file with the correct \r\n line endings.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://819733]
Approved by biohisham
Front-paged by biohisham
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (7)
As of 2024-04-16 18:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found