Question about glob.glob <--newbie
Sean Berry
sean_berry at cox.net
Mon May 3 20:47:54 EDT 2004
>>> r = glob.glob('/*')
>>> r
['/dev', '/usr', '/stand', '/etc', '/cdrom', '/proc', '/bin', '/boot',
'/mnt', '/modules', '/root', '/sbin', '/tmp', '/var', '/sys', '/COPYRIGHT',
'/kernel.GENERIC', '/kernel', '/compat', '/home', '/kernel.old',
'/modules.old']
>>>
>>> r = glob.glob('/usr/websites/*')
>>> r
[]
I can do a
>>> import os
>>> dirs = os.system('ls /usr/websites')
and that works. Why doesn't glob.glob work on /usr/websites?
What I am trying to do is write a simple script that will recursively search
for and replace key words in all files. I am doing this mainly for practice
since I already can write a shell script or use an awk/sed combo. Does
anyone have anything that does a similar task? Thanks
More information about the Python-list
mailing list