Andrew Stacey


About
Andrew Stacey
Information about my research, teaching, and other interests.

By: Andrew Stacey
Contact details


Andrew Stacey


blosxom icon


Tue, 27th Sep 2011 (HowDidIDoThat :: Unix)

Copying to VFAT with safe filenames

Script for copying files from a Linux filesystem to a memory stick with a VFAT filesystem that gets rid of accented characters nicely and eliminates other non-standard characters.

find . -type f |  \
 perl -MFile::Path::Tiny \
      -MFile::Copy \
      -MText::Unaccent::PurePerl \
      -lne \
        '$orig = $_;
         $st = unac_string($_);
         $st =~ s%[^-\./[:alnum:]]%_%g;
         $st =~ m%(.*)/%;
         File::Path::Tiny::mk("/media/Kingston/Music/" . $1);
         copy($orig, "/media/Kingston/Music/" . $st);
        '

[Full link]
Last modified on:
Tue, 27th Sep 2011