myftp.bat :
ftp -s:\files_ftp.txt host_name
del xxx*.
files_ftp.txt:
user_name
password
prompt
mput xxx*.
bye
How can I do this?
For Windows 95/98/ME:
Use a FOR IN DO statement to scan for the relevant files
and build (simultaneously) both a Batch file to delete them
and an FtpScript to PUT them in the same FOR IN DO pass.
Then execute the two workfiles. This way the files used for
the operations will be in correct synchrony.
This demo shows typical syntax, but is completely untested:
====Begin cut-and-paste (omit this line)
@ECHO OFF
IF (GOTO:)==(%1) %1%2 {Subroutine-Handler}
REM Initialise FTP script>_FtpScript
ECHO. user_name>>_FtpScript
ECHO. password>>_FtpScript
REM Initialise Batch Workfile>_WorkFile.bat
LFNFOR ON
:: Specify the relevant wildcard to put/delete
FOR %%F IN (files*.*) DO CALL %0 GOTO: _FSCAN %%F
LFNFOR OFF
:: Run the FtpScript and then delete it
ftp -s:_FtpScript host_name
DEL _FtpScript
:: Run the deletion workfile and then delete it
FOR %%C IN (CALL DEL) DO %%C _WorkFile.bat
GOTO EOF {=Subroutine-section-below=}
:_FSCAN (Usage: CALL %0 GOTO: _FSCAN FileSpec)
:: Build Batch workfile to delete PUT files
ECHO. DEL %3>>_WorkFile.bat
:: Build FtpScript to PUT files
ECHO. put %3>>_FtpScript
:EOF {End-of-file}
====End cut-and-paste (omit this line)
Win9x GUI study/demo only. Cut-and-paste as Batch script (file with .BAT
extension). Lines that don't begin with 2 spaces have wrapped by mistake.
--
(pp) William Allen