用批处理上传文件到ftp目录下的实现方法

为了快速将项目中开发的补丁程序通过ftp...

为了快速将项目中开发的补丁程序通过ftp快速上传到linux下,感觉每次用flashFxp等工具麻烦),写了个简单的批处理,与大家分享一下。

将以下代码保存为.bat格式的文件,每次将要上传的补丁保存在规定的本地目录中,只要双击执行此文件就能上传到你的指定目录上。

说明:

192.168.1.1 ftp ip 地址
21 端口
username 用户名
password 密码
temp.txt 保存ftp信息的临时文件,上传后删除
C:\Documents and Settings\user\桌面\patch\upload_dir\1.zip 上传upload_dir目录下的zip文件
test/temp%date%.rar 上传到用户目录下并且以“temp+当前日期” 对上传文件重命名

最后是删除本地文件

复制代码 代码如下:
@echo off
echo open 192.168.1.1 21 >> temp.txt
echo user username password>> temp.txt
echo bin >> temp.txt
echo put “C:\Documents and Settings\user\桌面\patch\upload_dir\1.rar” “test/temp%date%.rar” >> temp.txt
echo bye >> temp.txt
ftp -n -s:”temp.txt”
del /q C:\Documents and Settings\user\桌面\patch\upload_dir\1.rar
del /q temp.txt
pause

以上内容是小编给大家介绍的用批处理上传文件到ftp目录下的实现方法,希望对大家有所帮助!

Related Posts

Comments are closed.