Illegal File Name – Compact Flash card

When taking pictures my Nikon D90‘s display had flashed that the card needed to be formatted “frm”. I’ve seen this before and simply power off the camera, then reset the card and all is well. I continued shooting and all was good but what I didn’t know is all images on the card prior to the format warning were given “illegal” names that prevented me from accessing them.

Issue – Illegal File Name
My SanDisk Ultra-II FAT32 compact flash card had about 20 pictures I could not copy, move or rename. All had “illegal” characters in the file name for Microsoft Windows:
\ / : * ? <> |

Instead of files named like: DSC_5399.JPG
I had: D*?_*/+$.JPG

The files with illegal characters would not copy over. I tried renaming them, tried an old Compact flash recovery tool. I was stumped. Then I tried running a simple Windows CHKDSK on the Compact Flash card.

Solution – CHKDSK + DOS Rename command

  1. Run CHKDSK on the card – Here’s how: http://support.microsoft.com/kb/315265
  2. CHKDSK moved all bad files to a new folder “found”
    1. You may have to uncheck “Hide Protected Operating System Files” to see the folder:
      Tools > Folder Options > View
  3. Inside the folder were files named: file001.chk, file002.chk, file003… etc.
  4. I assumed (optimistically) that renaming the files to .JPG would save them
  5. I copied the Found folder and all contained CHK files to my hard disk
  6. I fired up a Command Windows: Start -> Run -> type CMD -> click Run / or hit enter
  7. Change directories to your “found” folder
  8. I entered the DOS Rename command for all files: ren *.chk *.jpg
  9. The above command renames any file “*” with .CHK to .JPG
  10. Viola! All the files are renamed with JPG extension and operate as expected!
  11. and then I formatted the card

Leave a Reply

Your email address will not be published. Required fields are marked *