I have a flash drive that I want to put a bunch of files on, but they have 64-bit filenames (they're on an EXT4 filesystem currently), and the flash drive needs to be FAT32, which doesn't accept some characters or filename lenghts. Is there a tool that will automatically convert conflicting filenames into something functional for FAT32?

I'm using Xubuntu 16.10 64-bit.


I think what you're looking for is just the rename utility...

For instance this would rename every file longer than 10 character to the first 10 characters:

rename 's/^(.{10}).*/$1/' *

so "superlongfilename" becomes "superlongf" but you run the risk of files overwriting each other if they truncate to the same name. You can to a "trial run" without making any real changes with the "-n" switch, which will just print what it would do.

The rename utility supports regex (obviously) so you can match/replace/substitute as needed to meet your needs...

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.