Re: [sorta offtopic] Removing bad bytes from filenames

Paul Martin <[email protected]>
Newsgroups gmane.comp.multimedia.ogg.vorbis.general
Message-ID <[email protected]>
On Mon, Aug 20, 2007 at 02:07:05PM -0500, Chris Harrington (Personal) wrote:

> Like the example I cite above, I can't seem to actually pass the
> correct parameter to rename to get it to remove \0277 from my
> filenames. I really don't want to do this manually.

Do you have Perl's rename installed?

$ rename
Usage: rename [-v] [-n] [-f] perlexpr [filenames]

The following will remove any non ASCII characters from filenames in
the current directory:

   rename -v 's/[^ -~]//g' ./*

Add a "-n" to the options to see what it would do before you let it
rip, so that you know you'll be happy with the results.

If you have a directory tree to do this to...

   find ./dir_root -type f | rename -v 's/[^ -~]//g'

where ./dir_root is the root directory of the tree.

-- 
Paul Martin <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.