实现FTP整站上传的批处理代码
实现FTP整站上传的批处理代码
发布时间:2016-12-28 来源:查字典编辑
摘要:@echooffrem设置FTP服务器地址setftpIP=192.168.0.2rem设置FTP用户名setftpUser=MyUserr...

@echo off rem 设置FTP服务器地址 set ftpIP=192.168.0.2 rem 设置FTP用户名 set ftpUser=MyUser rem 设置FTP密码 set ftpPass=MyPass rem 设置待上传的本地文件夹目录 set UpFolder=C:/test rem 生成待上传的本地文件夹列表 type nul>%temp%/FolderList.txt for /r "%UpFolder%" %%a in (.) do ( set FullName=%%a setlocal enabledelayedexpansion set FolderName=!FullName:%UpFolder%=! set FolderName=!FolderName:~1,-2! echo,!FolderName!>>%temp%/FolderList.txt endlocal ) >"%temp%/ftpFile.txt" echo,%ftpUser% >>"%temp%/ftpFile.txt" echo,%ftpPass% >>"%temp%/ftpFile.txt" echo bin >>"%temp%/ftpFile.txt" ( for /f "usebackq tokens=*" %%a in ("%temp%/FolderList.txt") do ( echo cd / echo mkdir "%%a" echo cd "/%%a" echo mput "%UpFolder%/%%a/*.*" ) ) >>"%temp%/ftpFile.txt" echo ! rd /s /q "%UpFolder%" >>"%temp%/ftpFile.txt" echo ! md "%UpFolder%" >>"%temp%/ftpFile.txt" echo bye ftp -v -i -s:"%temp%/ftpFile.txt" %ftpIP%

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新DOS/BAT学习
热门DOS/BAT学习
脚本专栏子分类