I have deleted some of my python scripts about 3 months ago and now I want to recover them, I tried Data Rescue 4 which is told as the best data recovery software but it was unable to find .py extensions, however it found the files which I deleted with .py files together. They told me that there is no support for .py files. So are there someone who tried to recover python script files and had success on Ubuntu, OSX or Windows?

  • «which is told as the best data recovery software» According to who? ;) Nevertheless, you didn't specify which file system you want to recover from. Is it NTFS, FAT, EXT4, HFS+, ...? – Andrea Lazzarotto May 21 '16 at 21:31
  • That's why I ask here if someone tried to recover .py files and are there any software which recover .py files. If there is, that will be my best data recovery but for now according to user reviews data rescue 4 should find any deleted common extension files and actually it did. I tried NTFS with my external HDD and HFS+ with mac. – hzleonardo May 24 '16 at 9:09
  • Unless you are talking about file carving, there is no such thing as "supporting Python files". A recovery program doesn't care what files you have, unless its a carver. Of course Python files do not have a fixed header, so carving is basically excluded. Sorry but I still do not understand what kind of file system was containing those files. Either it was NTFS or HFS+ (or something else). It cannot be both at the same time. – Andrea Lazzarotto May 24 '16 at 9:13
  • Python is programming language, these files are actually .txt files. When you change it to .py, then they are python scripts with .py extension. These are python codes I wrote. Also these codes were in my mac system(HFS+) and I copied them to my Samsung external HDD(exfat) and deleted from mac, after 2-3 months I deleted them from external HDD too. So these codes must be recovered in my mac or my HDD. I tried both of them, no success. That's the story. – hzleonardo May 24 '16 at 12:18
  • When I contact to Data Rescue 4 support, they told me that .py extensions are not supported and they told me that I can try to add header with 5 sample python files. I tried it too. – hzleonardo May 24 '16 at 12:27

Usually I do a grep on the device file (you need to know some specific text on the files you are looking) and I get the text I want. I just need to cut the needed data.

This usually works well for all non encrypted filesystems, but requires some manual works and to discriminate the last version (vs. many of temporary files created and deleted by editors).

I used it both in Linux and OSX.

  • Actually I did what you are saying. I searched for specific text in around 9000 found .txt files, for instance I searched for "import" which all python codes need to have and "selenium" which my python codes have but I couldn't find anything. Did you recover your python scripts with Data Rescue 4? – hzleonardo May 20 '16 at 11:28
  • You should be more precise on the search, with some specific construct/sentence that you used on the script. And I used grep with some extra arguments, in order to have the 2000 lines before and after the searched text. But in my case I knew exactly a string that were only on the deleted file. [It works anyway, but with a much more manual selection of right sector of the disk] – Giacomo Catenazzi May 20 '16 at 12:13
  • In some of my scripts, there were specific url's which I scrape, I searched for that too, no success. I guess the problem is data recovery software cannot find .py files, also it doesn't recover these files as .txt either. Can you tell me which software did you use to recover your scripts? – hzleonardo May 20 '16 at 12:37
  • My method has nothing to do with recovery software. I just explain how to recover data from a filesystem, without tools. Note: the more you use the disk, there are much more probability that some other program will overwrite the sector with original data. – Giacomo Catenazzi May 20 '16 at 12:49
  • Yes so it seems, it is not possible to recover my scripts. Anyway, thank you for your help. – hzleonardo May 20 '16 at 17:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.