@echo off @for /F "usebackq tokens=1,2,3 delims=- " %%i in (`date /T`) do @set TODAYS_DATE=%%i%%j%%k @for /F "tokens=*" %%i in ("%0") do (set DRIVER=%%~dpi) @for /F "tokens=*" %%i in ("%DRIVER%.") do (@set WORK_SPACE=%%~fi) @for /f "eol=# tokens=1,2" %%i in (controlfile.properties) do ( for /f "tokens=1,2* delims==" %%I in ("%%i") do ( if /I "%%I"=="ftp_address" set ftpAddr=%%J if /I "%%I"=="ftp_user" set ftpUser=%%J if /I "%%I"=="ftp_passwd" set ftpPwd=%%J if /I "%%I"=="put_directory" set ftpDir=%%J ) ) @set RleaseSrcDir=%1 @set PutDirName=%2 @if "%1" == "" goto Usage @if "%2" == "" goto Usage @set ConfigFile=ftp.txt @if exist %ConfigFile% del /S/Q %ConfigFile% > nul @echo %ftpUser%>>%ConfigFile% @echo %ftpPwd%>>%ConfigFile% @echo cd %ftpDir%>>%ConfigFile% @echo mkdir %PutDirName%>>%ConfigFile% @echo cd %PutDirName%>>%ConfigFile% @for /f "delims=" %%i in ('dir /b %RleaseSrcDir%') do echo put %%i>>%ConfigFile% @echo bye>>%ConfigFile% @echo ============================== @echo ***FTP Message: "%RleaseSrcDir%" ALL files in the directory will be upload to ftp. @echo ============================== @echo ***FTP Message: "ftp:\\%ftpDir%\%PutDirName%" the following files will be upload to here. @set NUM=0 @echo ============================== for /f %%i in ('dir /b "%RleaseSrcDir%"') do ( set /a NUM+=1 set filename=%%i call :DispalayFileName %%i ) ) @echo ****************************** @echo *** [y] Upload [*] quit *** @echo ****************************** @set /p Confirm="[y]?: " @if "%Confirm%"=="y" (goto ftp) else (goto :eof) :DispalayFileName @echo (%NUM%) %1 @goto :eof :ftp @pushd %RleaseSrcDir% ftp -s:%WORK_SPACE%\%ConfigFile% %ftpAddr% @popd pause @goto :eof :Usage echo Usage: %0 [FilePath] [CreateDirName] pause @goto :eof
用windows批处理写的ftp自动上传脚本
原创diter 博主文章分类:shell/bash ©著作权
文章标签 windows bash ftp 文章分类 运维
-
ftp 自动上传脚本
ftp 自动 上传 脚本
职场 休闲 -
自动上传远程FTP脚本
#!/bin/bash ftp_hotname=远程FTP服务器IP(:端口号) ftp_user=FTP服务器的账号 ftp_userpassword=账号密码 dbdata
职场 ftp 休闲 FTP脚本 上传远程FTP脚本 -
Linux ftp 自动上传备份文件脚本
<br /> <br /> DB 用RMAN 直接将备份文件放在盘柜上了,为了以防万一
linux 服务器 脚本 任务 blog