Changing the Case of a FAT File Name

While converting a stop-action series of images from the HDR-AS30V into a movie, I wanted change all the image files on a USB Flash drive from DSC00008.JPG to dsc00008.jpg, so as to simplify typing their names.

Alas, because the camera’s exFAT filesystem cares not one whit about case, the obvious command doesn’t work:

rename 's/JPG/jpg/' /mnt/part/*
/mnt/part/DSC00008.JPG not renamed: /mnt/part/DSC00008.jpg already exists

So you must do each piece in two steps:

rename 's/JPG/jpgx/' /mnt/part/*
rename 's/jpgx/jpg/' /mnt/part/*
rename 's/DSC/dscx/' /mnt/part/*
rename 's/dscx/dsc/' /mnt/part/*

Obvious once you see it, I suppose…

See the comments for a better way:

rename 'y/A-Z/a-z/' *JPG

2 thoughts on “Changing the Case of a FAT File Name

  1. I don’t actually know the rename command, but ‘y/A-Z/a-z/’ might be the shorter form of that…

    1. Got it in one!

      The rename command uses a Perl expression and that is a swamp I won’t venture into.

      Thanks for the tip…

Comments are closed.