| echo 参数基本检测通过,准备执行数据库备份 |
| echo 参数基本检测通过,数据库备份现在开始>>%today% |
| echo 今天是%Date%,时间是:%Time:~0,2%:%Time:~3,2%:%Time:~6,2%,正在执行数据库备份………… |
| echo 今天是%Date%,时间是:%Time:~0,2%:%Time:~3,2%:%Time:~6,2%,正在执行数据库备份…………>>%today% |
| |
| echo 正在创建生成文件列表的ftp文件,请稍候……… |
| echo 正在创建生成文件列表的ftp文件,请稍候…………>>%today% |
| ping -n 3 127.1>nul |
| |
| echo 正在将远程登录用户名写入ftp文件…………>>%today% |
| echo %Remote_User%>%Log_Path%command.txt |
| echo 正在将远程登录密码写入ftp文件…………>>%today% |
| echo %Remote_Pwd%>>%Log_Path%command.txt |
| echo 正在将下载方式写入ftp文件…………>>%today% |
| echo type Binary>>%Log_Path%command.txt |
| echo 正在判断远程父目录是否为根目录 …………>>%today% |
| if "%Remote_Path%" NEQ ".." ( |
| if "%Remote_Path%" NEQ "" ( |
| echo 正在将进入远程目录%Remote_Path%的语句写入ftp文件…………>>%today% |
| echo cd %Remote_Path%>>%Log_Path%command.txt |
| ) |
| ) |
| echo 正在判断远程子目录…………>>%today% |
| if "%Remote_Directory%" NEQ "" ( |
| echo 正在将子目录列表的生成语句写入ftp文件…………>>%today% |
| for %%i in (%Remote_Directory%) do ( |
| echo 正在将子目录列表%%i的生成语句写入ftp文件…………>>%today% |
| echo mls %%i %Log_Path%%%i.txt>>%Log_Path%command.txt |
| ) |
| ) else ( |
| echo 由于没有填写子目录,则将根目录下文件列表的生成语句写入ftp文件…………>>%today% |
| echo mls .. FileList.txt>>%Log_Path%command.txt |
| ) |
| echo close>>%Log_Path%command.txt |
| echo quit>>%Log_Path%command.txt |
| echo 正在对command.txt文件进行判断 |
| if not exist "%Log_Path%command.txt\" ( |
| if exist "%Log_Path%command.txt" ( |
| echo %Log_Path%command.txt文件创建成功 |
| echo %Log_Path%command.txt文件创建成功>>%today% |
| ) else ( |
| echo %Log_Path%command.txt文件创建失败,程序将退出。 |
| echo %Log_Path%command.txt文件创建失败,程序退出>>%today% |
| pause |
| echo exit |
| ) |
| ) else ( |
| echo 您输入的参数存放日志路径中有竟然有一个名为Command.txt的文件夹,请手动删除后,重新运行程序。 |
| echo 您输入的参数存放日志路径中竟然有有一个名为Command.txt的文件夹,程序退出。>>%today% |
| pause |
| exit |
| ) |
| |
| echo 正在执行服务器目录文件列表创建,请稍候………… |
| echo 正在执行服务器目录文件列表创建,请稍候…………>>%today% |
| ping -n 3 127.1>nul |
| ftp -i -s:%Log_Path%command.txt %Remote_IP% |
| echo 正在检查已创建的服务器目录文件列表,请稍候………… |
| echo 正在检查已创建的服务器目录文件列表,请稍候…………>>%today% |
| if "%Remote_Directory%" NEQ "" ( |
| for %%i in (%Remote_Directory%) do ( |
| if not exist "%Log_Path%%%i.txt\" ( |
| if exist "%Log_Path%%%i.txt" ( |
| echo %Log_Path%%%i.txt文件创建成功! |
| echo %Log_Path%%%i.txt文件创建成功!>>%today% |
| ) else ( |
| echo 对不起,%Log_Path%%%i.txt文件创建失败!程序将退出! |
| echo %Log_Path%%%i.txt文件创建失败!程序终止>>%today% |
| pause |
| exit |
| ) |
| ) else ( |
| echo 您输入的参数存放日志路径%Log_Path%中有竟然有一个名为%%i.txt的文件夹,请手动删除后,重新运行程序。 |
| echo 您输入的参数存放日志路径%Log_Path%中竟然有有一个名为%%i.txt的文件夹,程序退出。>>%today% |
| pause |
| exit |
| ) |
| ) |
| ) else ( |
| if not exist "%Log_Path%FileList.txt\" ( |
| if exist "%Log_Path%FileList.txt" ( |
| echo %Log_Path%FileList.txt文件创建成功! |
| echo %Log_Path%FileList.txt文件创建成功!>>%today% |
| ) else ( |
| echo 对不起,%Log_Path%FileList.txt文件创建失败! |
| echo %Log_Path%FileList.txt文件创建失败!程序终止>>%today% |
| pause |
| exit |
| ) |
| ) else ( |
| echo 您输入的参数存放日志路径%Log_Path%中有竟然有一个名为FileList.txt的文件夹,请手动删除后,重新运行程序。 |
| echo 您输入的参数存放日志路径%Log_Path%中竟然有有一个名为FileList.txt的文件夹,程序退出。>>%today% |
| pause |
| exit |
| ) |
| ) |
| |
| |
| echo 程序开始下载文件,请耐心等待………… |
| echo 程序开始下载文件,请耐心等待…………>>%today% |
| if "%Remote_Directory%" NEQ "" ( |
| for %%i in (%Remote_Directory%) do ( |
| echo 正在创建目录%Local_Path%%%i………… |
| echo 创建目录%Local_Path%%%i…………>>%today% |
| md %Local_Path%%%i |
| echo 正在下载%Remote_Path%%%i文件夹备份,请稍候………… |
| echo 正在下载%Remote_Path%%%i文件夹备份,请稍候…………>>%today% |
| ping -n 3 127.1>nul |
| for /f "delims=." %%j in (%Log_Path%%%i.txt) do ( |
| if not exist "%Local_Path%%%i\%%j.txt\" ( |
| if not exist "%Local_Path%%%i\%%j.txt" ( |
| echo 正在创建下载文件%%j.txt的脚本,请稍候………… |
| echo 正在创建下载文件%%j.txt的脚本,请稍候…………>>%today% |
| echo %Remote_User%>%Log_Path%GetFiles.txt |
| echo %Remote_Pwd%>>%Log_Path%GetFiles.txt |
| echo type Binary>>%Log_Path%GetFiles.txt |
| if "%Remote_Path%" NEQ "" ( |
| if "%Remote_Path%" NEQ ".." ( |
| echo cd %Remote_Path%>>%Log_Path%GetFiles.txt |
| ) |
| ) |
| echo cd %%i>>%Log_Path%GetFiles.txt |
| echo lcd %Local_Path%%%i>>%Log_Path%GetFiles.txt |
| echo mget "%%j.txt">>%Log_Path%GetFiles.txt |
| echo close>>%Log_Path%GetFiles.txt |
| echo quit>>%Log_Path%GetFiles.txt |
| ftp -i -s:%Log_Path%GetFiles.txt %Remote_IP% |
| echo 正在检查文件%Local_Path%%%i\%%j.txt,请稍候…… |
| echo 正在检查文件%Local_Path%%%i\%%j.txt,请稍候……>>%today% |
| if exist "%Local_Path%%%i\%%j.txt\" ( |
| echo ————下载%Local_Path%%%i\%%j.txt成功! |
| echo ————下载%Local_Path%%%i\%%j.txt成功!>>%today% |
| ) else ( |
| echo ——由于未知原因,下载%Local_Path%%%i\%%j.txt失败! |
| echo ——由于未知原因,下载%Local_Path%%%i\%%j.txt失败!>>%today% |
| ) |
| ) else ( |
| echo %Local_Path%%%i\%%j.txt已存在,正在跳过———— |
| echo %Local_Path%%%i\%%j.txt已存在,正在跳过————>>%today% |
| ) |
| ) else ( |
| echo 您输入的参数存放备份路径%Local_Path%%%i中有竟然有一个名为%%j.txt的文件夹,请手动删除后,重新运行程序。 |
| echo 您输入的参数存放备份路径%Local_Path%%%i中竟然有有一个名为%%j.txt的文件夹,程序退出。>>%today% |
| pause |
| exit |
| ) |
| ) |
| ) |
| ) else ( |
| echo 由于没有指定服务器子目录,程序将把服务器父目录下的文件备份到您指定的本地目录中………… |
| echo 由于没有指定服务器子目录,程序将把服务器父目录下的文件备份到您指定的本地目录中…………>>%today% |
| for /f "delims=," %%j in (%Log_Path%FileList.txt) do ( |
| if not exist "%Local_Path%%%j.txt\" ( |
| if not exist "%Local_Path%%%j.txt" ( |
| echo 正在创建下载文件%%j.txt的脚本,请稍候………… |
| echo 正在创建下载文件%%j.txt的脚本,请稍候…………>>%today% |
| echo %Remote_User%>%Log_Path%GetFiles.txt |
| echo %Remote_Pwd%>>%Log_Path%GetFiles.txt |
| echo type Binary>>%Log_Path%GetFiles.txt |
| if "%Remote_Path%" NEQ "" ( |
| if "%Remote_Path%" NEQ ".." ( |
| echo cd %Remote_Path%>>%Log_Path%GetFiles.txt |
| ) |
| ) |
| echo lcd %Local_Path%>>%Log_Path%GetFiles.txt |
| echo mget "%%j.txt">>%Log_Path%GetFiles.txt |
| echo close>>%Log_Path%GetFiles.txt |
| echo quit>>%Log_Path%GetFiles.txt |
| ftp -i -s:%Log_Path%GetFiles.txt %Remote_IP% |
| echo 正在检查文件%Local_Path%%%i\%%j.txt,请稍候…… |
| echo 正在检查文件%Local_Path%%%i\%%j.txt,请稍候……>>%today% |
| if exist "%Local_Path%%%j.txt" ( |
| echo ————下载%Local_Path%%%i\%%j.txt成功! |
| echo ————下载%Local_Path%%%i\%%j.txt成功!>>%today% |
| ) else ( |
| echo ——由于未知原因,下载%Local_Path%%%i\%%j.txt失败! |
| echo ——由于未知原因,下载%Local_Path%%%i\%%j.txt失败!>>%today% |
| ) |
| ) else ( |
| echo %Local_Path%%%i\%%j.txt已存在,正在跳过———— |
| echo %Local_Path%%%i\%%j.txt已存在,正在跳过————>>%today% |
| ) |
| ) else ( |
| echo 您输入的参数存放备份路径%Local_Path%中有竟然有一个名为%%j.txt的文件夹,请手动删除后,重新运行程序。 |
| echo 您输入的参数存放备份路径%Local_Path%中竟然有有一个名为%%j.txt的文件夹,程序退出。>>%today% |
| pause |
| exit |
| ) |
| ) |
| ) |
| |
| |
| echo 程序正在清除临时文件,请稍候………… |
| echo 程序将删除%Log_Path%command.txt文件…………>>%today% |
| del %Log_Path%command.txt |
| if exist "%Log_Path%command.txt" ( |
| echo %Log_Path%command.txt文件删除失败,程序继续运行 |
| echo %Log_Path%command.txt文件删除失败,程序继续运行>>%today% |
| ) else ( |
| echo %Log_Path%command.txt文件删除成功 |
| echo %Log_Path%command.txt文件删除成功>>%today% |
| ) |
| |
| echo 程序正在删除下载备份之ftp语句文件,请稍候………… |
| echo 程序正在删除下载备份之ftp语句文件,请稍候…………>>%today% |
| Del %Log_Path%GetFiles.txt |
| if exist "%Log_Path%GetFiles.txt" ( |
| echo %Log_Path%GetFiles.txt文件删除失败,程序继续运行 |
| echo %Log_Path%GetFiles.txt文件删除失败,程序继续运行>>%today% |
| ) else ( |
| echo %Log_Path%GetFiles.txt文件删除成功 |
| echo %Log_Path%GetFiles.txt文件删除成功>>%today% |
| ) |
| |
| |
| echo 程序正在删除临时文件列表文件,请稍候………… |
| echo 程序正在删除临时文件列表文件,请稍候…………>>%today% |
| if "%Remote_Directory%" NEQ "" ( |
| for %%i in (%Remote_Directory%) do ( |
| Del %Log_Path%%%i.txt |
| if exist "%Log_Path%%%i.txt" ( |
| echo %Log_Path%%%i.txt文件删除失败,程序继续运行 |
| echo %Log_Path%%%i.txt文件删除失败,程序继续运行>>%today% |
| ) else ( |
| echo %Log_Path%%%i.txt文件删除成功 |
| echo %Log_Path%%%i.txt文件删除成功 >>%today% |
| ) |
| ) |
| ) else ( |
| del %Log_Path%FileList.txt |
| if exist "%Log_Path%FileList.txt" ( |
| echo %Log_Path%FileList.txt文件删除失败,程序继续运行 |
| echo %Log_Path%FileList.txt文件删除失败,程序继续运行>>%today% |
| ) else ( |
| echo %Log_Path%FileList.txt文件删除成功 |
| echo %Log_Path%FileList.txt文件删除成功>>%today% |
| ) |
| ) |
| echo 恭喜您,本次备份工作已经圆满完成!详情请查看%today%日志文件! |
| echo 恭喜您,本次备份工作已经圆满完成!>>%today% |
| echo 数据已被备份到%Local_Path%目录中。>>%today% |
| echo 完成时间:%Time:~0,2%:%Time:~3,2%:%Time:~6,2%>>%today% |
| pause |
| exitCOPY |