473,396 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

A 'find' utility that continues through zipped directory structure?

Is there a Python 'find' -like utility that will continue the file
search through any zippped directory structure on the find path?

Sep 27 '05 #1
2 1484
"B Mahoney" wrote:
Is there a Python 'find' -like utility that will continue the file
search through any zippped directory structure on the find path?


something like this?

# File: zipfind.py
import fnmatch, os, sys, zipfile

program, root, name = sys.argv

for dirpath, dirnames, filenames in os.walk(root):
for file in fnmatch.filter(filenames, name):
print os.path.join(dirpath, file)
for file in fnmatch.filter(filenames, "*.zip"):
try:
zip = zipfile.ZipFile(os.path.join(dirpath, file))
except zipfile.BadZipfile:
pass # cannot read this file
else:
for f in fnmatch.filter(zip.namelist(), name):
print os.path.join(dirpath, file) + ":" + f

$ python zipfind.py aggdraw "README*"
aggdraw/README
aggdraw/agg2/README.txt
aggdraw/dist/aggdraw-1.1b3-20050925.zip:aggdraw-1.1b3-20050925/README.txt

</F>

Sep 27 '05 #2
An effbot utility? I'll try that.

Thank you

Sep 27 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: FISH | last post by:
Ever have one of those days when you're not sure if it's you who's gone mad, or the rest of the world? I have an Open Source project on SourceForge for communication with YSMG - Yahoo's IM...
2
by: Rosa | last post by:
Hi, I'm looking for an elegant solution on how to find the youngest file within a given directory. At the moment I'm storing all files in an array and loop through it comparing the creation date...
1
by: Cyd | last post by:
Can someone please tell me the method in C# I use to search a directory structure to find all files with the same name. I was hoping some sort of array would be returned or something Thanks in...
4
by: amit | last post by:
hello, I need to design a scandisk type utility in c. which will check the disk, the directory structure, FAT for errors nd correct them..... can u please tell me how to proceed... do i hv to...
2
by: enquiring mind | last post by:
-learning python with limited knowledge of linux. -get error msg 21 "file or directory does not exist" -running Suse linux 10. -haven't had a problem before - rebooted several times. -python...
2
by: Rahul Babbar | last post by:
Hi, Is there any way to find the SQL that is causing the Locks. I am using SYSPROC.SNAPSHOT_LOCK to find out the locks on the table, but i am unable to find out which SQL statement was...
8
by: inFocus | last post by:
Hello, I am new to python and wanted to write something for myself where after inputing two words it would search entire drive and when finding both names in files name would either copy or move...
9
by: =?ISO-8859-1?Q?Tom=E1s_=D3_h=C9ilidhe?= | last post by:
Recently, there was a Linux program distributed as source code, and it compiled fine on the majority of systems. However on some systems, it failed to compile. On some of these systems, people were...
0
by: hsheboul | last post by:
Thanks to Markus for pointing me to all the Apache stuff http://bytes.com/topic/html-css/answers/876342-automating-web-site-template My Web site is hosted on a shared Linux hosting, that runs the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.