#20 Fixing Bad Filenames

In the beginning there was the command line—and the filename had form and consistency. Then came the GUI-based file manager. And people could put just about anything they wanted to in a filename. This may look nice in the GUI, but it creates real problems for those of us who still use the command line.

For example, I've had to deal with files with names that looked like this:

Fibber&Molly [10-1-47] "Fibber's lost $" (v\g snd!).mp3

Now I count no fewer than 17 nasty characters in that string that require special handling. So if I want to play from the command line I must type this:

$ mpg123 Fibber\&Molly\ \[10-1-47\]\ "Fibber\'s\ lost\ \$"\ \(v\\g snd\!\).mp3

It would be nice if there was a program that would take ...

Get Wicked Cool Perl Scripts now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.