From owner-freebsd-questions@FreeBSD.ORG Fri Jun 4 02:56:06 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EEC4816A4CE for ; Fri, 4 Jun 2004 02:56:06 -0700 (PDT) Received: from smtp.infracaninophile.co.uk (happy-idiot-talk.infracaninophile.co.uk [81.2.69.218]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3E56243D2F for ; Fri, 4 Jun 2004 02:56:06 -0700 (PDT) (envelope-from m.seaman@infracaninophile.co.uk) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost [IPv6:::1]) i549tnEj060389 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 4 Jun 2004 10:55:49 +0100 (BST) (envelope-from matthew@happy-idiot-talk.infracaninophile.co.uk) Received: (from matthew@localhost)id i549tnwS060388; Fri, 4 Jun 2004 10:55:49 +0100 (BST) (envelope-from matthew) Date: Fri, 4 Jun 2004 10:55:49 +0100 From: Matthew Seaman To: Joachim Dagerot Message-ID: <20040604095549.GF85236@happy-idiot-talk.infracaninophile.co.uk> Mail-Followup-To: Matthew Seaman , Joachim Dagerot , freebsd-questions@freebsd.org References: <200406040941.i549fdv15239@thunder.trej.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="sDKAb4OeUBrWWL6P" Content-Disposition: inline In-Reply-To: <200406040941.i549fdv15239@thunder.trej.net> User-Agent: Mutt/1.5.6i X-Virus-Scanned: clamd / ClamAV version devel-20040525, clamav-milter version 0.71 X-Virus-Status: Clean X-Spam-Status: No, hits=-4.8 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=2.63 X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on happy-idiot-talk.infracaninophile.co.uk cc: freebsd-questions@freebsd.org Subject: Re: Odd characters in filename X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2004 09:56:07 -0000 --sDKAb4OeUBrWWL6P Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 04, 2004 at 11:41:38AM +0200, Joachim Dagerot wrote: > I unpacked a rar file and find myself standing with a lot of files > with strange characters like accents etc. >=20 > When I do tab for completion the characters 'escapes' to for example > "\264" (backward slash). >=20 > I tried to write a small rename method in java but neither the > File.list() or by providing the filename in args[0] makes java > understand these odd characters. >=20 > How can I rename these files in a not too manual way? Hmmm... something like this: % perl -e 'for(@ARGV) { ($f =3D $_) =3D~ s/[^[:ascii:]]/_/g; rename $_,= $f; }' \ filename... which will replace all non-ascii characters with '_'. This doesn't take any account of possible name collisions and it will probably get it's knickers in a twist if you use it to rename whole directory trees, rather than just files in the current directory. Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks Savill Way PGP: http://www.infracaninophile.co.uk/pgpkey Marlow Tel: +44 1628 476614 Bucks., SL7 1TH UK --sDKAb4OeUBrWWL6P Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQFAwEcliD657aJF7eIRAnCGAJ96FHEso+yTR0qc1qOzHU8hA1rJyACcCPPe XbQX/vZzzTcD554EFVP+uag= =DVWK -----END PGP SIGNATURE----- --sDKAb4OeUBrWWL6P--