블로그 이미지
흰색앵초

calendar

1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

Notice

2011. 7. 7. 12:32 카테고리 없음
import os
import sys
import string
import time
import glob
from ftplib import FTP

ftphost = 'xxx.xxx.xxx.xxx'
ftpuid = 'backup'
ftppwd = 'backup'

ftp = FTP(ftphost)
ftp.login(ftpuid,ftppwd)
ftp.cwd('db/mssql2000/')

files = glob.glob('D:\database\data\mssql\BACKUP\*')
for file in files:
        filenames = string.split(file,'\\')
        filename = filenames[-1] #get filename
        if os.path.isfile(file):
                print "Put:",file
                ftp.storbinary("STOR "+filename,open(file,'rb'),1024)
                time.sleep(2)

ftp.quit()
posted by 흰색앵초