At some point during the upgrade process from Drupal 4.7.11 to 6.16 (through versions of 5.x, with contributed module updates along the way), one of my sites' files tables got screwed up. All the 'filepath' entries were converted to 'filepath' (instead of sites/

Luckily, since the original 4.7.x version of the site only saved files directly under the 'files' directory, I could write a simple SQL query to update all the filepath entries in the files table:

UPDATE files SET filepath = CONCAT('sites/',filename);

I ran that query, and it put in sites/ for each row in the table.

One caveat: If you ever saved files with ImageField, FileField, etc., under different subdirectories of your main files folder, and your filepaths were screwed up... well... good luck fixing that! I hope you have a backup :)