Advertisements

Archive for February 5th, 2014

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
Advertisements

2 Comments