这篇文章主要介绍了如何实现FTP整站上传的批处理代码,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。
@echo offrem 设置FTP服务器地址set ftpIP=192.168.0.2rem 设置FTP用户名set ftpUser=MyUserrem 设置FTP密码set ftpPass=MyPassrem 设置待上传的本地文件夹目录set UpFolder=C:/testrem 生成待上传的本地文件夹列表type nul>%temp%/FolderList.txtfor /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 byeftp -v -i -s:"%temp%/ftpFile.txt" %ftpIP%
感谢你能够认真阅读完这篇文章,希望小编分享的“如何实现FTP整站上传的批处理代码”这篇文章对大家有帮助,同时也希望大家多多支持编程网,关注编程网行业资讯频道,更多相关知识等着你来学习!