Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 Aug 2018 15:52:45 +0200 (CEST)
From:      Wojciech Puchar <wojtek@puchar.net>
To:        Eugene Grosbein <eugen@grosbein.net>
Cc:        Wojciech Puchar <wojtek@puchar.net>, freebsd-hackers@freebsd.org
Subject:   Re: how to use ftp(1) in batch mode
Message-ID:  <alpine.BSF.2.20.1808311551550.4910@puchar.net>
In-Reply-To: <5B87F083.6080804@grosbein.net>
References:  <alpine.BSF.2.20.1808301449001.26234@puchar.net> <5B87F083.6080804@grosbein.net>

next in thread | previous in thread | raw e-mail | index | archive | help
thank you. it works. actually even without netrc

(echo command1;echo command2)|ftp ftp://user:password@server/

On Thu, 30 Aug 2018, Eugene Grosbein wrote:

> On 30.08.2018 19:50, Wojciech Puchar wrote:
>> i want to delete all say *.foo files on remote ftp server
>>
>> while it's clear how to download file using ftp(1) in batch mode, i cannot
>> figure how to delete files in batch mode without any keyboard interaction.
>>
>> Could you help
>
> $ echo "machine localhost login ftp password user@" >> ~/.netrc
> $ printf "cd incoming\nprompt off\nmdel *.foo\nquit\n" | ftp localhost
> Connected to localhost.
> 220 host.xxx FTP server (Version 6.00LS) ready.
> 331 Guest login ok, send your email address as password.
> 230- Your welcome message here.
> 230 Guest login ok, access restrictions apply.
> Remote system type is UNIX.
> Using binary mode to transfer files.
> 250 CWD command successful.
> Interactive mode off.
> 250 DELE command successful.
> 250 DELE command successful.
> 250 DELE command successful.
> 221 Goodbye.
>
> But, you better use ncftp3 port/package for such jobs.
>
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.20.1808311551550.4910>