Date: Fri, 4 Jun 2004 10:55:49 +0100 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: Joachim Dagerot <freebsd@dagerot.nu> Cc: freebsd-questions@freebsd.org Subject: Re: Odd characters in filename Message-ID: <20040604095549.GF85236@happy-idiot-talk.infracaninophile.co.uk> In-Reply-To: <200406040941.i549fdv15239@thunder.trej.net> References: <200406040941.i549fdv15239@thunder.trej.net>
next in thread | previous in thread | raw e-mail | index | archive | help
--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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040604095549.GF85236>