From owner-freebsd-questions Sun Sep 20 20:40:28 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id UAA14416 for freebsd-questions-outgoing; Sun, 20 Sep 1998 20:40:28 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from home2.stratos.net (mail.venturephotos.com [209.117.220.2] (may be forged)) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id UAA14402 for ; Sun, 20 Sep 1998 20:40:23 -0700 (PDT) (envelope-from drifter@localhost.net) Received: from pm3-5-21.stratos.net [207.86.133.21] by home2.stratos.net (SMTPD32-4.03) id AA7276800C8; Sun, 20 Sep 1998 23:39:30 EDT Date: Sun, 20 Sep 1998 23:46:09 -0400 (EDT) From: Rob DeMarco To: BEAUPRE Antoine cc: ringlord@bbs.dcoisp.net, freebsd-questions@FreeBSD.ORG Subject: Re: Accessing files with spaces in the names. In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sun, 20 Sep 1998, BEAUPRE Antoine wrote: > On Sat, 19 Sep 1998 ringlord@bbs.dcoisp.net wrote: > > > Greetings folks. > > I just received a zip file from a client, which contains a series of > > files with spaces in the file names. > > > For example, when I do an ls on the directory the files are zipped into, > > one of the files has a name of Merchant Lot 1 Photo.jpg > > > This zipfile was created on a win95 machine that allows long file names. > > I have tryed to figure out how to rename these files to files with one > > name to them. > > when I typed, mv Merchant Lot 1 Photo.jpg merchantlot.jpg > > Try: > % mv Merchant\ Lot\ 1\ Photo.jpg merchantlot.jpg > > It works under tcsh. Anyways, any shell that knows about filename > completion will complete the filename to a compatible filename. A word of warning -- the original `csh' will /not/ properly quote spaces and other "metacharacters" when using file completion. The `\' trick should work with any self-respecting shell, but it's probably easier in this case just to use the single or double quotes. % mv 'Merchant Lot 1 Photo.jpg' Merchant_Lot_1_Photo.jpg ought to work under any shell out there (/bin/sh, /bin/csh, /usr/local/bin/{bash,pdksh,zsh} ...). Double quotes (") will work too, but be careful about `$' in your file names, because `$words's will usually be interpreted as a variable and replaced (probably with nothing.) Oh well, `man sh' or `man csh' should give some of the gory details. > > > I was told that the files Merchant Lot 1 Photo.jpg could not be found. > > > How does one go about accessing these files with such long names? > > I have even tryed inserting . _ marks, but nothing works. > > Normal. Marks and dots and such will make a different filename, in tcsh, > '\' is the escape char, which means "the following must be treated as > such". > > +-----------------------------------+ > | Free the world from businessmen | > | Free yourself from your money | > +-----------------------------------+ > Free the web. > Spidey > > visit: http://www.JSP.UMontreal.CA/~beaupran -Rob To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message