How can I archive files using the Zip function in Python?
-
I created a source to make a back-up and a destination directory to store them.What I want is to back up the files in Zip format to the specified destination directory using a Python script. So how could I implement it in Python using the Zip function? One suggestion I got is to download http://gnuwin32.sourceforge.net/packages/zip.htm and install it. I installed the software but I'm unable to create a backup. I want to do it automatically by the system using the os.system() command. Please help.
-
Answer:
You could lookup how to create a zip file with zip tool via command line and call that command with the help of os.system() or you could use the zip python module. For example i use 7zip, which can be downloaded from http://www.7-zip.org. After installing lookup how to create zip file via commandline http://linux.die.net/man/1/7z. Make sure that the 7zip is in your environment variable http://en.wikipedia.org/wiki/PATH_%28variable%29 . And you can call the zip command with the https://docs.python.org/2/library/os.html#os.system in your python script. Or you could just read up http://pymotw.com/2/zipfile/ and do it yourself. I suggest the latter method.
Hariharan Rangasamy at Quora Visit the source
Related Q & A:
- How can I pass global variables into a function?Best solution by Stack Overflow
- how can I write this shell script in python?Best solution by Stack Overflow
- How can I convert real player audio files into mp3?Best solution by Yahoo! Answers
- How can i attach word,excel,mp3,picture files to e-mail messages in yahoo mail quickly?Best solution by Yahoo! Answers
- How can I open files with the extension .ef?Best solution by solvusoft.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.