On Mon, May 21, 2012 at 6:38 AM, wolfrage8...@gmail.com <wolfrage8...@gmail.com> wrote: > All, I have had a curious idea for awhile, and was wondering the best > way to implement it in Python and if it is even possible. The concept > is this, a file that is actually a folder that contains multiple files > (Like an Archive format). The actual files are really un-important. > What I want is for the folder to be represented as a single file by > any normal file browser, but to be able to access the files with-in > via Python. I will actually use the word archive to represent my > mystical folder as a file concept for the rest of this message. Some > additional things I would like to be possible: is for multiple copies > of the program to write to the same archive, but different files > with-in at the same time (Reading & Writing to the archive should not > lock the archive as long as they are different files); and for just > the desired files with-in the archive to be loaded to memory with out > having to hold the entire archive in memory. > Use case for these additional capabilities. I was reading about how > some advanced word processing programs (MS Word) actually save > multiple working copies of the file with-in a single file > representation and then just prior to combining the working copies it > locks the original file and saves the working changes. That is what I > would like to do. I want the single file because it is easy for a user > to grasp that they need to copy a single file or that they are working > on a single file, but it is not so easy for them to grasp the multiple > file concepts. > > MS Word uses Binary streams as shown here: > http://download.microsoft.com/download/5/0/1/501ED102-E53F-4CE0-AA6B-B0F93629DDC6/WindowsCompoundBinaryFileFormatSpecification.pdf > Is this easy to do with python? Does it prevent file locking if you > use streams? Is this worth the trouble, or should I just use a > directory and forget this magical idea? > A piece of reference for my archive thoughts, ISO/IEC 26300:2006 chapter 17.2 > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor
I'm not sure if this is exactly what you are looking for, but python handles tar files (various compression formats) with this module: http://docs.python.org/library/tarfile.html. What is your motivation for this idea? -- Joel Goldstick _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor