473,545 Members | 1,744 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

globbing multiple wildcards

I have a path spec similar to '/home/*/.mozilla/*/*/cache*/*' (this
will probably look familiar to *nix users) with multiple wildcards. I
am finding it difficult gathering ALL file pathnames which match this
spec. Can anyone shed some light on this for a python noob?

TIA
Bob

Jul 19 '05 #1
5 4863
what about :
martin@ubuntu:~ $ python
Python 2.4.1 (#2, Mar 30 2005, 21:51:10)
[GCC 3.3.5 (Debian 1:3.3.5-8ubuntu2)] on linux2
Type "help", "copyright" , "credits" or "license" for more information.
import glob
print glob.glob('/home/*/.mozilla/*/*/Cache*/*') ['/home/martin/.mozilla/firefox/dem8d5eu.defaul t/Cache/_CACHE_MAP_',
'/home/martin/.mozilla/firefox/dem8d5eu.defaul t/Cache/_CACHE_001_',
..........
'/home/martin/.mozilla/firefox/dem8d5eu.defaul t/Cache/66FA72F2d01',
'/home/martin/.mozilla/firefox/dem8d5eu.defaul t/Cache/85F82253d01',
'/home/martin/.mozilla/firefox/dem8d5eu.defaul t/Cache/CE3B4D9Cd01']


Jul 19 '05 #2
ut*********@gma il.com wrote:
I have a path spec similar to '/home/*/.mozilla/*/*/cache*/*' (this
will probably look familiar to *nix users) with multiple wildcards. I
am finding it difficult gathering ALL file pathnames which match this
spec. Can anyone shed some light on this for a python noob?


import glob
glob.glob('/home/*/.mozilla/*/*/cache*/*')
Jul 19 '05 #3
OK, I guess it WAS that easy. :-P

Thanks for the replys.

Bob

Jul 19 '05 #4
Is there any way to make this recursive? That is what I was looking
for.

Sorry I wasn't too clear before.

Bob

Jul 19 '05 #5
Then take a look at os.walk, see
http://docs.python.org/lib/os-file-dir.html

Jul 19 '05 #6

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

Similar topics

4
19791
by: Evil Bert | last post by:
Is there anyway to compare a field with multiple string values using LIKE? Here's the statement I have now: SELECT * FROM list WHERE email LIKE CONVERT( _utf8 'hotmail@hotmail.com' USING latin1 ) OR email LIKE CONVERT( _utf8 'john@hotmail.com' USING latin1 )"; I know how to do it using the IN operator, SELECT * FROM list
11
9132
by: Shyguy | last post by:
I need to import a text file pretty much daily. I download the file and change the name to a standard name and then run the code to import the file into a table in my database. The problem is that the file starts with a standard name but adds the date and some other stuff to the end of the file name. Is there a way I could use a wildcard...
10
5097
by: Alvaro Puente | last post by:
Hi all! Do any of you know if wildcards are accepted when calling rename() function? Thanks/Alvaro
6
539
by: mark | last post by:
I have an asp.net ecommerce web application on a remote web server. I'm using an Access database on the back end. I've notice a few strange things. When I mimic an multiple user environment by surfin it in multiple browsers simultaneously the site generates a generic runtime error after awhile. I'm thinking this has something to do with my...
1
6665
by: Anandan | last post by:
Hi, This is regarding Dataset Filter: WILDCARD CHARACTERS Both the * and % can be used interchangeably for wildcards in a LIKE comparison. If the string in a LIKE clause contains a * or %, those characters should be escaped in brackets (). If a bracket is in the clause, the bracket characters should be escaped in brackets (for example ...
0
1994
by: Web learner | last post by:
Individual file download works fine. But when I try to download multiple files, for example using wildcards in the following code, I get error. How to solve it? System.Net.WebClient Client = new System.Net.WebClient(); Client.DownloadFile("ftp://123.123.456.0/*.RPT", @"C:\downloadedFiles\*.RPT"); Are there other possibilities??
3
2633
by: Daz | last post by:
Hi everyone! This is my first time posting in this group, although I have been watching it for the past few months and have to say this is possibly the best group I have seen on Google so far! (That wasn't a butt-kissing comment, I just believe in giving praise when it's due). I would like to copy files using globbing, and I am not sure...
0
1146
by: Kenneth Porter | last post by:
Due to a mis-feature in Windows filesystems, I need a globbing function in C or C++ that can emulate the globbing done by the built-in FindFirstFile API. The license should allow it to be incorporated into the wxWidgets framework. Background: http://groups.google.com/group/comp.soft- sys.wxwindows/browse_thread/thread/210dbcbbb9694a79
5
36626
by: nidaar | last post by:
From a security point of view, is accepting wildcards like "%" in input parameters of stored procedures against any best practices? As an example, if a user defined function uses "Productname LIKE @ProductName" in WHERE clause of a select statement, and a stored procedure uses the user defined function while passing @ProductName input...
0
7393
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...
0
7653
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. ...
0
7803
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...
1
7411
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...
0
7749
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5322
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...
0
3444
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3439
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1012
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.