I currently do the same thing using FTP Batch files in Windows 2003.  Here's
how it works.  It downloads every file in the directory,  creates a backup
before further processing and deletes the file of the AS400.  It also
includes some basic error checking.  But this of course is working from the
other side. ;)


2 Batch Files Required

1st Batch - test1.bat
@echo off
echo Downloading, Please Wait.
set wrkdir=C:\Here
Set folder=/qdls/test
set Backup=%wrkdir%\Backup

del %TEMP%\test1.tmp
del %TEMP%\test2.tmp
del %TEMP%\test3.tmp
del %TEMP%\test4.tmp
del %TEMP%\test5.tmp
del %TEMP%\test6.tmp

:start 

echo open AS400IP > PikTik.ftp
echo.>> PikTik.ftp
echo user Test >> PikTik.ftp
echo Test >> PikTik.ftp
echo quote TIME 2000 2000>> PikTik.ftp
echo quote site namefmt "1">> PikTik.ftp
echo ls %folder%>> PikTik.ftp
echo.>> PikTik.ftp
echo bye >> PikTik.ftp

ftp -n -s:PikTik.ftp >%TEMP%\test1.tmp
:find

find /I "/qdls/test/" <%TEMP%\test1.tmp >%TEMP%\test2.tmp
for /f "tokens=3 delims=/" %%a in (%TEMP%\test2.tmp) do call test2.bat %%a

echo.
echo Cleaning Up, Please Wait.
for %%a in (*.txt) do copy %%a %backup% /Y
for %%a in (*.txt) do del %%a

2nd Batch - test2.bat
echo open AS400IP > PikTik.ftp
echo.>> PikTik.ftp
echo user Test >> PikTik.ftp
echo Test >> PikTik.ftp
echo quote TIME 50000 50000>> PikTik.ftp
echo quote site namefmt "1">> PikTik.ftp
echo binary>> PikTik.ftp
echo cd %folder%>> PikTik.ftp
echo get %1 %1.txt>> PikTik.ftp
echo.>> PikTik.ftp
echo bye >> PikTik.ftp

ftp -n -s:PikTik.ftp >%TEMP%\test3.tmp


find /I "550-" <%TEMP%\test3.tmp >%TEMP%\test4.tmp
for /f "tokens=2,3*" %%a in (%TEMP%\test4.tmp) do echo There was an error
FTPing %%a %%b from the AS/400 %date% %time%>> NoDown.txt
for /f "tokens=1" %%a in (%TEMP%\test4.tmp) do goto end

echo open AS400IP > PikTik.ftp
echo.>> PikTik.ftp
echo user Test >> PikTik.ftp
echo Test >> PikTik.ftp
echo quote TIME 50000 50000>> PikTik.ftp
echo quote site namefmt "1">> PikTik.ftp
echo binary>> PikTik.ftp
echo cd %folder%>> PikTik.ftp
echo delete %1>> PikTik.ftp
echo.>> PikTik.ftp
echo bye >> PikTik.ftp

ftp -n -s:PikTik.ftp >%TEMP%\test5.tmp


:end
del %TEMP%\test3.tmp
del %TEMP%\test4.tmp
del %TEMP%\test5.tmp

> 
> Is there a way to either concatentate all the files or FTP a set of files 
> when they have arbitrary file names? 
> 
> Any ideas would be most appreciated. 
> 




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.