how to use ftp(1) in batch mode
Eugene Grosbein
eugen at grosbein.net
Thu Aug 30 13:26:44 UTC 2018
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.
More information about the freebsd-hackers
mailing list