uploading the latest file to ftp with batch command

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

This entry was posted in batch command and tagged , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>