Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Delete local files after FTP mput

499 views
Skip to first unread message

ne13...@netc.pt

unread,
Sep 16, 2002, 6:47:57 AM9/16/02
to
want a script(bat or perl) to transfer same files and after this
delete the files that are transfered.
The above example doesn't work because the bcc* files are generated
countinuously and when I do a del, I will delete files that are not
tranfered yet.
I want delete only the files that are transfered.


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?

William Allen

unread,
Sep 16, 2002, 12:31:40 PM9/16/02
to
<ne13...@netc.pt> wrote in message

> want a script(bat or perl) to transfer same files and after this
> delete the files that are transfered.
> The above example doesn't work because the bcc* files are generated
> countinuously and when I do a del, I will delete files that are not
> tranfered yet.
> I want delete only the files that are transfered.
...snip

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


0 new messages