Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Aug 2018 20:26:27 +0700
From:      Eugene Grosbein <eugen@grosbein.net>
To:        Wojciech Puchar <wojtek@puchar.net>, freebsd-hackers@freebsd.org
Subject:   Re: how to use ftp(1) in batch mode
Message-ID:  <5B87F083.6080804@grosbein.net>
In-Reply-To: <alpine.BSF.2.20.1808301449001.26234@puchar.net>
References:  <alpine.BSF.2.20.1808301449001.26234@puchar.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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?5B87F083.6080804>