Python and lost files
Carl Banks
pavlovevidence at gmail.com
Thu Oct 1 18:52:37 EDT 2009
On Sep 30, 11:35 pm, "Timothy W. Grove" <tim_gr... at sil.org> wrote:
> Recently I purchased some software to recover some files which I had
> lost. (A python project, incidentally! Yes, I should have kept better
> backups!) They were nowhere to found in the file system, nor in the
> recycle bin, but this software was able to locate them and restore them.
I could have used that yesterday, if it were able to work for a
network Samba drive. (Yeah, not likely.)
> I was just wondering if there was a way using python to view and recover
> files from the hard drive which would otherwise remain lost forever?
Obviously, if that program was able to do it, it's possible.
On Unix-like OSes, and probably others, it's possible to read the raw
data on a disk the same way as you would read any file. So Python can
do it without any system-level programming. Recent versions (I think
2.6+) can use mmap, too, now that it supports an offset parameter.
I don't think you can do that in Windows, though. I think you'd have
to use special system calls (via ctypes, for example).
Carl Banks
More information about the Python-list
mailing list