From owner-freebsd-hackers@freebsd.org Fri Aug 31 13:53:10 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 848F8FCC168 for ; Fri, 31 Aug 2018 13:53:10 +0000 (UTC) (envelope-from wojtek@puchar.net) Received: from puchar.net (puchar.net [194.1.144.90]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "puchar.net", Issuer "puchar.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 0DDC3732A7 for ; Fri, 31 Aug 2018 13:53:09 +0000 (UTC) (envelope-from wojtek@puchar.net) Received: Received: from 127.0.0.1 (localhost [127.0.0.1]) by puchar.net (8.15.2/8.15.2) with ESMTPS id w7VDqpBP007334 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 31 Aug 2018 15:52:51 +0200 (CEST) (envelope-from puchar-wojtek@puchar.net) Received: from localhost (puchar-wojtek@localhost) by puchar.net (8.15.2/8.15.2/Submit) with ESMTP id w7VDqjWS007325; Fri, 31 Aug 2018 15:52:46 +0200 (CEST) (envelope-from puchar-wojtek@puchar.net) Date: Fri, 31 Aug 2018 15:52:45 +0200 (CEST) From: Wojciech Puchar To: Eugene Grosbein cc: Wojciech Puchar , freebsd-hackers@freebsd.org Subject: Re: how to use ftp(1) in batch mode In-Reply-To: <5B87F083.6080804@grosbein.net> Message-ID: References: <5B87F083.6080804@grosbein.net> User-Agent: Alpine 2.20 (BSF 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Aug 2018 13:53:10 -0000 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. > >