[Gllug] Making filenames 'FAT-safe' in bash

James Courtier-Dutton james.dutton at gmail.com
Tue Nov 30 19:19:39 UTC 2010


On 30 November 2010 12:30, Dylan <dylan at dylan.me.uk> wrote:
> Hi All,
>
> I have a bash script which takes a list of files and copies them to a usb
> stick, partially re-creating the original directory structure as it goes. This
> all functions as expected until it reaches a file with non-FAT compatible
> characters. So, how do I remove these characters? I need to handle filenames
> with ' and " in them as well as ?, !, (, ), [, ], & ...
>
> Any pointers would be gratefully received ...
>

You could convert then to their hex version.

Ie. the method URLs use.

So ? would become %3F

You can then convert them back when you copy the data back off the FAT drive.
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list