FTP Upload newest file using batch file?
Posted on 2011-03-21
I am trying to create a batch file that would upload the newest file in a directory to an FTP folder. So far I have this:
@echo off & setLocal EnableDelayedExpansion
for /f "tokens=* delims=" %%a in ('dir/b/a-d/od') do (set latest=%%a)
> #.ftp echo o 10.1.2.229
>> #.ftp echo anonymous
>> #.ftp echo email@example.com
>> #.ftp echo cd /DATALOG/CDAT/
>> #.ftp echo bin
>> #.ftp echo put !latest!
>> #.ftp echo bye
However, it seems to stop at "150 Opening BINARY mode data connection", and doesn't transfer the file.
What am I doing wrong?