diff --git a/cck.install b/cck.install
index 49a2f9b..cc2ccb4 100644
--- a/cck.install
+++ b/cck.install
@@ -93,3 +93,53 @@ function cck_update_7000() {
     db_add_field('cck_field_settings', 'language', $field);
   }
 }
+
+function cck_update_7001() {
+  // Query the existing D6 files table for possible duplicate URIs in D7.
+  if (db_table_exists('files')) {
+    $query = "SELECT f1.fid, f1.filename, f1.filepath FROM {files} f1 WHERE (SELECT count(f2.filepath) FROM {files} f2 WHERE f2.filepath = f1.filepath) > 1 ORDER BY f1.filename";
+    $result = db_query($query);
+    $last_file = '';
+    $current_file = '';
+    foreach ($result as $record) {
+      $current_file = strtolower($record->filepath);
+
+      if ($current_file == $last_file) {
+        // Log an error if the file copy destination is not writable.
+        $directory = str_replace('/' . $old_file, '', $record->filepath);
+        if (!file_prepare_directory($directory, FILE_CREATE_DIRECTORY)) {
+          watchdog('cck', 'The directory %directory could not be created or is not accessible.', array('%directory' => $directory));
+        }
+        else {
+          // Log an error if the destination does not contain a valid stream.
+          $destination = variable_get('file_default_scheme', 'public') . '://';
+          $destination_scheme = file_uri_scheme($destination);
+          if (!$destination_scheme || !file_stream_wrapper_valid_scheme($destination_scheme)) {
+            watchdog('cck', 'The file could not be copied, because the destination %destination is invalid.', array('%destination' => $destination), 'error');
+          }
+          else {
+            $files_dir = variable_get('file_directory_path', 'files') . '/';
+            $path_without_files = strtolower(str_replace($files_dir, '', $record->filepath));
+            // Get the new file location and copy the file.
+            $new_uri = file_destination($destination . $path_without_files, FILE_EXISTS_RENAME);
+            $new_filename = array_pop(explode('/', $new_uri));
+            $new_filepath = $files_dir . str_replace($destination, '', $new_uri);
+            // Copy the file on disk.  Leaving the original file in place means embeded links will still work.
+            if (!copy($record->filepath, $new_filepath)) { 
+              watchdog('cck', t('Unable to safely copy file from !old to !new', array('!old' => $record->filepath, '!new' => $new_filepath)), 'error');
+            }
+            // Update the database to use the new filename.
+            $num_updated = db_update('files') 
+              ->fields(array(
+                'filename' => $new_filename,
+                'filepath' => $new_filepath,
+              ))
+              ->condition('fid', $record->fid, '=')
+              ->execute();
+          }
+        }
+      }
+      $last_file = strtolower($record->filepath);
+    }
+  }
+}
