[Tutor] Program to lock folders under win32

Oliver Maunder olivermaunder at gmail.com
Sun Sep 4 11:45:18 CEST 2005

On 04/09/05, Byron <byron at christianfreebies.com> wrote:
> >>I want to make a program to lock folders (so the user can only access
> >>them if he knows the password) under win32, the only problem is that I
> >>have no idea how to start or what to do. Do you guys have any ideas of 
> >>how to do it?

There's a program called Magic Folders which does this - 
This actually hides the folders, rather than locking them. However, it seems 
to be integrated with the operating system at a very low level. I don't 
think you'd be able to get this kind of integration with a Python program.

Normally, one would accomplish this via Windows file / folder
> permissions. However, it also requires that you are working with a MS 
> Windows domain server environment.

This would also require that you are using NTFS rather than FAT32.

An approach I'd look at is this: When the folder is "locked", your Python 
program reads the contents of the folder, and writes the data into an 
encrypted file. To unlock the folder, the program reads the encrypted file 
and recreates the file/folder structure.

I'm new to Python myself, so I'm not sure how you'd implement this. I'm sure 
there are modules to handle encryption but you'd have to work out how to 
organise your data file. You could create a dictionary, with the keys being 
the filenames and the values being the file contents. Someone on this list 
mentioned the "shelve" module a couple of days ago - this is apparently an 
easy way to save a dictionary to disk.

Anyway - just my idea - feel free to discuss or dismiss it!


(by the way - it's my first post. Hello everyone!)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050904/0127e806/attachment.html

More information about the Tutor mailing list