Wednesday, August 25, 2010

"Cannot rename file: Cannot read from the source file or disk."

Do you work in an environment that uses Macs and Windows? Do you have a Windows Server that's being used for file sharing? Are you running into the issue, "Cannot rename file: Cannot read from the source file or disk." or "Cannot delete file: Cannot read from the source file or disk."?

I recently ran into an issue where a user reported that their files were missing from the server. Upon further inspection of the Windows server, I noticed that the files were there, but along with them were a lot of forked files. More information on forked files can be found here:
http://xahlee.org/mswin/mac_windows_file_conv.html

At any rate, I thought it might be a forked file issue, so I removed all unnessary forked files and had the user log out and log back in again. This didn't help. I then checked out the properties of the folder in Windows and noticed that it was reporting 0kb in size. Whoa, wait, I see that these are RAW files and there are about 30 of them all 15MB in size! How can the folder be reporting only 0kb in size? Out of curiosity I tried renaming the folder and noticed a trailing space. Dang! The folder is corrupt because of a trailing space! I tried renaming it, and that confirmed my suspicions, "Cannot rename file: Cannot read from the source file or disk." I was pretty confident this wasn't a HDD issue because there were no errors in the Event Viewer, or RAID software. Microsoft has an article about spaces at the end of the title of files and folders corrupting them, and to call Microsoft Support to correct it:

http://support.microsoft.com/kb/814594

You don't need to do that. You can fix it yourself. Here's how:

In Windows
1. Locate the offending folder
2. Create a new folder
3. Delete all unnecessary forked files if you have any.
4. Move the folders contents to the new folder.
5. Delete the offending folder with the following command:

C:\share\offending-folder\>rd /s "\\?\C:\share\offending-folder "
Note the trailing space above. This will work with other illegal characters for NTFS that corrupt the folder.

You'll be prompted with:

\\?\C:\share\offending-folder , Are you sure
Y/N)?

Press Y

The folder will now be deleted, and access to the files moved to the new folder should be restored.

More information can be found here:
http://blog.dotsmart.net/2008/06/12/solved-cannot-read-from-the-source-file-or-disk/

I've done the following before many years ago, but I would suggest this as a last resort.
1. Get a Live CD, that's running Linux. I think I used STD, or Security Auditor when I last did this.
2. Remove the hard drive from the Windows computer and mount it in Linux with ntfs write capabilities
3. Fix the offending file's name.
4. Put the disk back into Windows computer and boot back into it, and check to ensure the file is renamed correctly and no longer causing issues.

3 comments:

Online Ustaad said...

I had the similar problem and faced it a lot of times. I often solve this type of problems using "Long Path Tool". It helped me in solving this error and all related errors. I hope you will also love it.

Tim Hangton said...

I suggest you Long Path Tool will let you easily delete, copy or rename long path files, you can try it for better service.

Beautiful blog said...

I suggest you try Long path tool is the very good program for easily delete, copy & rename long path files, error, unlock solution.
Try it and solve your problem.
I used long path tool and I solve my error, unlock problem solution.