From owner-freebsd-questions Mon Oct 12 20:09:05 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id UAA13277 for freebsd-questions-outgoing; Mon, 12 Oct 1998 20:09:05 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from emu.sourcee.com (emu.sourcee.com [199.201.159.173]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id UAA13141 for ; Mon, 12 Oct 1998 20:07:58 -0700 (PDT) (envelope-from nrice@emu.sourcee.com) Received: (from nrice@localhost) by emu.sourcee.com (8.8.8/8.8.3) id XAA29418; Mon, 12 Oct 1998 23:06:47 -0400 (EDT) Message-ID: <19981012230646.A29402@emu.sourcee.com> Date: Mon, 12 Oct 1998 23:06:46 -0400 From: Norman C Rice To: Sue Blake Cc: freebsd-questions@FreeBSD.ORG Subject: Re: ftp get filenames with spaces and junk text References: <19981012175615.48311@welearn.com.au> <19981012105901.A26212@emu.sourcee.com> <19981013053326.50449@welearn.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.91.1i In-Reply-To: <19981013053326.50449@welearn.com.au>; from Sue Blake on Tue, Oct 13, 1998 at 05:33:26AM +1000 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Tue, Oct 13, 1998 at 05:33:26AM +1000, Sue Blake wrote: > On Mon, Oct 12, 1998 at 10:59:01AM -0400, Norman C Rice wrote: > > On Mon, Oct 12, 1998 at 05:56:15PM +1000, Sue Blake wrote: > > > How do I get oddly named files from a macintosh ftp server to land on > > > my FreeBSD disk with a decent file name? Here's some examples: > > > > > > 981011 Small Bus. Sue > > > Extra bits for System.sit > > > > You can try the ncftp2/3 port -- with it you can use the tab key > > to complete file names. An alternative method would be to use > > a graphical FTP client and click on the file names. Using the > > standard FTP client you can try using wildcard characters > > (`*' and `?') to complete the file names, but YMMV. > > The plain ftp client does tab completion, wildcards, and command > history too. Some ftp commands rely on the capabilities of the remote > machine, and others the local machine. None of the above features work > on a remote ftp server that thinks all the world is a mouse. > > But that's not my problem. Getting the file off the macintosh is OK. > The only way is 'get "silly name of file"', no matter what client I use. > > Then later, on my own machine I go > mv "silly name of file" newname > or > mv sil* newname > so that I don't have to deal with the spaces etc in the original name. > For one or two files, that's easy enough. > > For lots of files, I could learn how to run a script on my machine to > rename them afterwards. Here's a script that changes spaces to underscores. #!/bin/sh for f in *; do n=`expr "xxx$f" : 'xxx\(.*\)' | tr -s '[ ]' '[_]'` /bin/mv "$f" "$n" done > But after reading the ftp man page, I see there > is a better method and I want to use it. > > The standard ftp client has a feature which can be activated to rename > all files automatically as it writes them to the local disk. I want to > learn how to use this feature of ftp. It is simple, and documened, but > I don't understand the syntax. Just use the FTP client's `ntrans' command as follows (this will change file name spaces to underscores). ntrans " " "_" before getting the files from the remote system. -- Regards, Norman C. Rice, Jr. > > Commands which depend on a cooperative ftp server are futile. > It is fairly easy to get the files to here from the server. > There are unixy ways to deal with the names after files arrive here. > I have an ftp client that can do this renaming on the fly. > I want to know how to use the ftp client to do this. > > Why? Because it's there, because I'm perverse, an idiot, stubborn, > curious, it seems like a fun thing to do, and because someone else > might find it handy too. > > > -- > > Regards, > -*Sue*- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message