Yussi Ariefiyono
Posts tagged ftp with batch file
uploading the latest file to ftp with batch command
Apr 8th
uploading the latest file to ftp, all you need 2 .bat files
fileup.bat
@echo off
echo user USERNAME> ftpcmd.dat
echo PASSWORD>> ftpcmd.dat
echo bin>> ftpcmd.dat
echo cd REMOTEPATH >> ftpcmd.dat
echo put %1>> ftpcmd.dat
echo quit>> ftpcmd.dat
ftp -n -s:ftpcmd.dat FTPADDRESS
del ftpcmd.dat
CALL.bat
@echo off
setlocal
:source directory
set srcDir=SOURCE DIRECTORY
set lastmod=
pushd “%srcDir%”
for /f “tokens=*” %%a in (‘dir /b /od 2^>NUL’) do set lastmod=%%a
if “%lastmod%”==”" echo Could not locate files.&goto :eof
:copy
call YOURPATH\fileup.bat “%lastmod%”
:delete
del “%lastmod%”
You call the CALL.bat, and the fileup.bat is for information
Transfer to FTP using batch command
Apr 8th
there are 2 file you need
1. info of your ftp ( store it in .txt)
in my case i named it info.txt with these code written:
yourusernameyourpasswordbincd yourremotedirectorybye
2. .bat file to connect to ftp and do what you want
in .bat file simply call the info.txt with this code:
ftp -s:log.txt YourFTPAddress