http://serverfault.com/questions/98731/bsd-remove-non-ascii-characters-from-all-files-in-a-directory-recursively


find dir -depth -exec rename -n 's/[^[:ascii:]]/_/g' {} \; | cat -v

you may need the cat -v to properly display any weird characters without your terminal getting screwed.

if that prints acceptable substitutions change the -n to -v.


Michel-André
**************************************************************

Le 2012-04-20 15:28, Jeremy a écrit :
Does anyone know of a utility or easy command that can clean up crazy
characters in filenames? Ideally transliterate them to nearest UTF
equivalent, but even just replacing them with underscores is better than
nothing.

I know how to mass rename etc, but there are characters I can't decode
at all to even use in a command. I seem to remember something used to
exist to do this for files to be transferred to FAT drives, or vice
versa...

Hmm now that I think about it I guess I could do something like

rename 's/^[a-z|0-9]/_/i' *

(which may also be wrong have not tested it yet). Anyways, would like a
better solution that could preserve more of the filename, or alternate
approaches.

Thanks,

Jeremy
_______________________________________________
mlug mailing list
[email protected]
https://listes.koumbit.net/cgi-bin/mailman/listinfo/mlug-listserv.mlug.ca
_______________________________________________
mlug mailing list
[email protected]
https://listes.koumbit.net/cgi-bin/mailman/listinfo/mlug-listserv.mlug.ca

Reply via email to