473,785 Members | 2,830 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1508
"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(di rpath, file)
for file in fnmatch.filter( filenames, "*.zip"):
try:
zip = zipfile.ZipFile (os.path.join(d irpath, file))
except zipfile.BadZipf ile:
pass # cannot read this file
else:
for f in fnmatch.filter( zip.namelist(), name):
print os.path.join(di rpath, file) + ":" + f

$ python zipfind.py aggdraw "README*"
aggdraw/README
aggdraw/agg2/README.txt
aggdraw/dist/aggdraw-1.1b3-20050925.zip:ag gdraw-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
5339
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 protocol. I keep the project source in three directories, based upon the code's function: one for the network API code itself, one for the support APIs (basic chat spam filtering, Swing models, rich text decoders, etc), and one for the test client...
2
1712
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 as follows: private string FileShare(string strURL) { string files; DateTime datLastWriteTime; DateTime datNewLastWriteTime;
1
3415
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 advance Cyd
4
1559
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 use the int13h or r there other ways too...?? Thanks....
2
3473
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 opened in shell/terminal program Konsole window like this user1@linux!~ - shell - Konsole Sessions View Bookmark Settings Help -first line in window gives me a linux prompt:
2
6414
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 responsible for the lock. Thanks a lot
8
2320
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 thoe files to a specified directory. But couple of attempts did not work as desired this is one of them. Could someone help fix it or maybe give a better example.
9
1427
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 getting errors for undeclared tokens, while others were getting linking errors. Anyway, the problem was that one of the source files was missing: #include <stdio.h>
0
2035
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 Apache 2.2 I got multiple static "utility" files: CSS, JavaScripts, Impages, etc. In order to maintain a coherent and consistent structure, I put all these kind of utility files in one directory hierarchy. However, this directory structure might...
0
9645
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10330
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10153
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10093
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7500
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3654
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2880
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.