Gregory Lund wrote: >> Using Peter's code, if you create a plain text file called >> "unzip_twice.py" containing: >> >> >> import glob >> import os >> import sys >> import zipfile >> >> source_file = sys.argv[1] >> dest_folder = sys.argv[2] >> >> zipfile.ZipFile(source_file).extractall(dest_folder) >> >> inner_zips_pattern = os.path.join(dest_folder, "*.zip") >> for filename in glob.glob(inner_zips_pattern): >> inner_folder = filename[:-4] >> zipfile.ZipFile(filename).extractall(inner_folder) >> > Consider it done, i have a new .py file saved as 'unzip_twice.py' > pasted below: > > import glob > import os > import sys > import zipfile > > source_file = sys.argv[1] > dest_folder = sys.argv[2] > > zipfile.ZipFile(source_file).extractall(dest_folder) > > inner_zips_pattern = os.path.join(dest_folder, "*.zip") > for filename in glob.glob(inner_zips_pattern): > inner_folder = filename[:-4] > zipfile.ZipFile(filename).extractall(inner_folder) > >> >> and then run it from the shell like this: >> >> python unzip_twice.py NAME-OF-ZIP-FILE NAME-OF-FOLDER-TO-EXTRACT-TO >> > In the IDLE 2.6.5 shell I typed (exactly what is in quotes, without
Don't use Idle, follow the instructions on http://www.windows7hacker.com/index.php/2009/08/how-to-open-dos-prompt-command-here-in-windows-7-and-more/ If you see the ugly little black window you are there an can type in your command. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor