diff --git a/README.md b/README.md index 15edc8b..4f82572 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -FTP数据备份工具 +

FTP数据备份工具

-使用步骤: -1、TsFTP目录放入解释器所在目录的funcext中; -2、(可选)修改默认配置信息:TsFTP\TsFTPBackupConfig.tsf; -3、参考examples\example1.tsl编写备份脚本; -4、(可选)添加备份脚本的定时调度。 \ No newline at end of file +使用步骤: +1、TsFTP目录放入解释器所在目录的funcext中,更新替换plugin\FileMgr.dll; +2、(可选)修改默认配置信息:TsFTP\TsFTPBackupConfig.tsf; +3、参考examples\example1.tsl编写备份脚本; +4、(可选)添加备份脚本的定时调度。 \ No newline at end of file diff --git a/TsFTP/TsFTPBackup.tsf b/funcext/TsFTP/TsFTPBackup.tsf similarity index 92% rename from TsFTP/TsFTPBackup.tsf rename to funcext/TsFTP/TsFTPBackup.tsf index 3547c18..26f06f6 100644 --- a/TsFTP/TsFTPBackup.tsf +++ b/funcext/TsFTP/TsFTPBackup.tsf @@ -19,7 +19,7 @@ Type TsFTPBackup = Class Begin if not Host then Host := defaultConfig['Host']; if not port then port := defaultConfig['Port']; - if not port then port := 21; + if not port then port := 990; if not username then username := defaultConfig['username']; if not password then password := defaultConfig['password']; if not initFtpObj() then return 0; @@ -48,14 +48,14 @@ Type TsFTPBackup = Class Begin path := ExtractFilePath(src); files := filelist('',src); + try + ftpObj.MakeDir(destPath); + except + end; for j,f in files do begin if f['FileName']='.' or f['FileName']='..' then continue; if pos('D',f['Attr']) then begin if recursive then begin - try - ftpObj.MakeDir(destPath+f['FileName']+'/'); - except - end; backupPath(path+'\\'+f['FileName']+"\\*",destPath+f['FileName']+'/',recursive); end; end else if f['Attr']='A' then begin @@ -100,7 +100,13 @@ Type TsFTPBackup = Class return 2; end; st_put:=CreateObject("TFileStream","",srcfile,0); - ret := ftpObj.Put(st_put,destfile,0); + try + ret := ftpObj.Put(st_put,destfile,0); + except + msg := 'Դļ('+srcfile+')->Ŀļ('+destfile+')ϴʧܡ'; + log(msg,'error'); + return 0; + end; size_d := ftpObj.Size(destfile); if size_s=size_d then begin msg := 'Դļ('+srcfile+')->Ŀļ('+destfile+')ϴɹ'; diff --git a/TsFTP/TsFTPBackupConfig.tsf b/funcext/TsFTP/TsFTPBackupConfig.tsf similarity index 71% rename from TsFTP/TsFTPBackupConfig.tsf rename to funcext/TsFTP/TsFTPBackupConfig.tsf index 971f85e..f4131eb 100644 --- a/TsFTP/TsFTPBackupConfig.tsf +++ b/funcext/TsFTP/TsFTPBackupConfig.tsf @@ -1,8 +1,8 @@ Function TsFTPBackupConfig(); Begin return array( - 'Host':'192.168.0.1', - 'Port':21, + 'Host':'192.168.104.42', + 'Port':990, 'username':'', 'password':'', 'logPath':'', diff --git a/plugin/FileMgr.dll b/plugin/FileMgr.dll new file mode 100644 index 0000000..f846238 Binary files /dev/null and b/plugin/FileMgr.dll differ