[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
hosts=["Shared_host"]
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
username=user[21:]
print "Collecting mailboxes for %s"%username
mailboxes_path="%s\\MYDOCU~1\\Exchange\\"%user
mailboxes_path=string.replace(mailboxes_path,'\\','\\\\')
mailboxes=glob.glob('%s*.pst'%mailboxes_path)
#~ print mailboxes_path
print '%s*.pst'%mailboxes_path #<--this looks perfect in the output!
print mailboxes
---------------------------------------------------------------
output
--------------------------------------------------------------
Collecting mailboxes for guy1
\\\\Shared_host\\d$\\users\\guy1\\MYDOCU~1\\Exchange\\*.pst
[]
Collecting mailboxes for guy2
\\\\Shared_host\\d$\\users\\guy2\\MYDOCU~1\\Exchange\\*.pst
[]
Collecting mailboxes for guy3
\\\\Shared_host\\d$\\users\\guy3\\MYDOCU~1\\Exchange\\*.pst
[]
-----------------------------------------------------------------
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