file backup in windows

Tim Golden Tim.Golden at
Wed Nov 22 11:02:14 CET 2006

| " c:\documents and settings\060577\Local Settings\Application
| Data\Microsoft\Outlook "
| where 060577 represents username. I want my script to 
| identigy the user
| logged in and go to the resp outlook folder or should be able to read
| outlook store directory path from registry and the copy the files to
| the desired path.
| ---------------------------------------------------
| how can i make the following code work, I have probelm with filepath
| declaration.
| ---------------------------------------------------
| import os, shutil
| filepath = ' C:\\Documents and Settings\\060577\\Local
| Settings\\Application Data\\Microsoft\\Outlook\\* '
| backup = ' D:\\temp\\outlook '
| os.system ("xcopy /s %s %s" % (filepath, backup))
| -----------------------------------------

I suggest you let the system work out most of the
filepath for you. Things like Application Data are
determined by the Windows Shell as they can change
according to Windows version / roaming profile settings
and so on. The following code snippet shows how to
get the Local Application Data folder. It assumes
you have installed the pywin32 extensions from

import os, sys
from import shell, shellcon

local_app_data = shell.SHGetSpecialFolderPath (0,
outlook_path = os.path.join (local_app_data, "Microsoft", "Outlook")

print outlook_path



This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

More information about the Python-list mailing list