Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Sep 1998 16:07:28 +0200
From:      Johann Visagie <wjv@cityip.co.za>
To:        ringlord@bbs.dcoisp.net, freebsd-questions@FreeBSD.ORG
Subject:   Re: Accessing files with spaces in the names.
Message-ID:  <19980923160728.D9414@cityip.co.za>
In-Reply-To: <TCPSMTP.18.9.19.14.56.8.3047923923.41086@bbs.dcoisp.net>; from ringlord@bbs.dcoisp.net on Sat, Sep 19, 1998 at 02:56:08PM -0500
References:  <TCPSMTP.18.9.19.14.56.8.3047923923.41086@bbs.dcoisp.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 19 Sep 1998 at 14:56 SAT, ringlord@bbs.dcoisp.net wrote:
>
> I just received a zip file from a client, which contains a series of
> files with spaces in the file names.

Under most Unix shells, you can quote the file names containing spaces using
single or double quotes, e.g.

$ mv "silly file" silly_file

> when I typed, mv Merchant Lot 1 Photo.jpg merchantlot.jpg
> 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.

If you're using a sh-derived shell, you can do something like this to change
the spaces to underscores in all filenames in the current directory:

  for i in *' '*; do
    mv "$i" `echo $i | sed 's/ /_/g'`
  done

-- V

Johann Visagie | Email: wjv@CityIP.co.za | Tel: +27 21 419-7878

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980923160728.D9414>