[Tutor] glob is driving me berserk

Shawhan, Doug (EM, ITS) Doug.Shawhan at ge.com
Tue Mar 30 18:18:07 EST 2004

I am having some difficulty with glob.glob()

This is the beginning of a simple mailbox backup program for multiple hosts.

Each of the mail directories has at least one username.pst mailbox in the proper directory.

Can anyone see why this is not working?

import glob
import string

for host in hosts:
	#first we collect the users on the host
	users=glob.glob("\\\\%s\\d$\\users\\*"%host) #<-- works great!
	for user in users:
		#strip extraneous pathname info from username. All hostnames are the same length
		print "Collecting mailboxes for %s"%username
		#~ print mailboxes_path
		print '%s*.pst'%mailboxes_path #<--this looks perfect in the output!
		print mailboxes

Collecting mailboxes for guy1
Collecting mailboxes for guy2
Collecting mailboxes for guy3


I have tried just typing in the full UNC path wit glob in a python shell and it works fine! 
Where am I getting twisted up here?

More information about the Tutor mailing list