file backup in windows

k.i.n.g. nkanthikiran at
Wed Nov 22 13:23:47 CET 2006

Hi ,

I am sorry I am providing the code i used as it is. Being newbee to
programming I have tinkerd with various options i found on the net.
start of the code
import os, sys ,shutil, win32file
import time
from import shell, shellcon

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

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

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

backup = 'D:\MailBackup'
backup2 =  'D:\MailBackup'
today = backup1 + '_'  + time.strftime ( '%Y-%m-%d')
now = time.strftime('%H.%M.%S')
target = today +'_'+ now
if not os.path.exists(target):
	os.mkdir(target) # make directory
	print 'Successfully created directory', target

#shutil.copy(source, backup)
#os.system( "copy  "(source,backup))
#os.system ("xcopy %s %s" % (source, backup1))
#os.system ("xcopy /s %s %s" % (outlook_path, backup1))
#os.system ("xcopy /s %s %s" % (backup2, backup1))
#os.system( 'xcopy /i D:\\MailBackup\\* d:\\temp\\outlook')
#win32file.CopyFile (outlook_path, backup, 0)
#os.system ("xcopy /s %s %s" % (backup,target))

os.system ("xcopy /s %s %s" % (source,target)) # this doesnt give me
any errors but the #work is not done

win32file.CopyFile (source, target, 1)

C:\Documents and Settings\060577\Local Settings\Application
Successfully created directory D:\temp\outlook1_2006-11-22_17.41.54

Traceback (most recent call last):
  File "C:\Documents and
Settings\060577\kk\source_code\py\Mypy\", line 34, in
    win32file.CopyFile (source, target, 1)
error: (123, 'CopyFile', 'The filename, directory name, or volume label
syntax is incorrect.')

More information about the Python-list mailing list