file backup in windows

k.i.n.g. nkanthikiran at gmail.com
Wed Nov 22 23:23:38 EST 2006


Hi,

The following code has worked for me, I will continue from here to make
this further userfriendly.
More I would like to know how can i distribute my python code as self
installer package.
In the process of learning programming I would like take
OutlookBackup.py as my first project and learn accordingly. Please
guide me in this.

Once again thank you all of you for your valuable suggestions

Regards,
Kk
---------------------------------------------------------------------------------------------------
import os, sys ,shutil, win32file
import time
from win32com.shell import shell, shellcon

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

# print outlook_path
#c:\documents and settings\060577\Local Settings\Application
Data\Microsoft\Outlook

source = outlook_path
#source = outlook_path +'\\*'
#print source

backup = 'D:\MailBackup'
backup1=r'D:\temp\outlook1'
backup2 =  'D:\MailBackup'
today = backup1 + '_'  + time.strftime ( '%Y-%m-%d')
now = time.strftime('%H.%M.%S')
target = today +'_'+ now
shutil.copytree(source, target) # copy directory tree

-------------------------------------------------------------------------------------------------------




More information about the Python-list mailing list