Monday, March 7, 2011

Delete or Remove undeletable file and folder in Windows 7 by taking ownership

Today, there was a strange encounter with a file inside a folder or to be precise say a .FLV file downloaded off Youtube refused to obey any normal file system command requested. I have Windows 7 Professional 32 bit , it's kind of new to me and there are lot of things yet to be discovered.



Once in a while, I organize my downloads and then I back it up. While doing so, this one .FLV file took forever to respond.  The problems I faced were:
  1. It wouldn't move to other folder or location at all, Windows Explorer just takes forever and keeps showing with 'discovering/calculating' message
  2. Tried to rename the file, and the explorer window didn't respond. When I fired further clicks, I saw 'Not responding' at the window's title bar. 
  3. Then I tried to delete it, and it wouldn't delete. Pretty adamant.
  4. I tried to check the properties of the file and my Windows 7 acted like nothing happened. I did that several times and saw no effect at all. It didn't show me any window or any message box. That was strange. 
  5. Now, I really needed to get this thing off my system. I did malware checks. I found out it's clean. I rebooted in safe mode(F8 key during bootup) and tried to delete it with no luck. I saw it has lock icon on it. After seeing, lock icon I thought some encryption is preventing me to do things.
  6. Back to normal mode, I tried to disable the Bitlocker encryption of Windows 7 but found out and remembered, encryption was already disabled. 
  7. I installed Unlocker for Windows 7, hoping that would definitely delete the culprit. But even my favorite tool in XP failed in Windows 7.
  8. I had this kind of problem in Windows XP when filename or folder name is awkwardly long and saved in last sub folder of  many folders hierarchy.( eg: c:\folder1\folder2\folder3\folder4\folder5\long file name) In those cases, I simply start to delete from last subfolder and it works. I checked if it's the same issue in Windows 7 and it was not.
  9. I tried to run that FLV file and out of shock it played. Hmmm... 
So, there was nothing wrong with the file. It's just something not letting me do file actions under Windows 7 environment. I searched microsoft and found they've some ownership settings running on file system for security. I didn't use Vista much but found out that  it is a known feature on Vista too. File ownership determines the permission level granted to certain users so that nobody could make unauthorized changes to the file / folder besides granted user. I was thinking Administrator could do anything. But I was wrong. Or may be bug where Administrator is restricted to perform system maintenance or may be lack of knowledge. I think, the FLV file must have different permission level from where it was generated first and it didn't just match with Windows 7's permission settings, so Windows 7 simple refused it's existence.

More searches, I found there was this little registry hack which will let you 'Take Ownership' of the file manually. I clicked, downloaded and run the registry hack. There was 'Take Ownership' shortcut menu added to my context menu. I right clicked on that FLV file, clicked 'Take Ownership' and voila. I could move the file , rename it or even delete it. The whole drama was because of this mismatched file permission settings.
 

Afterward, I tried to find if there is automatic Ownership of all files and folders under Administrators right in Windows 7 and I couldn't find a single solution for that. May be Windows 7 is not meant to be that way.

NOTE: This should work for all undeletable files and folders in Windows 7, can't delete file or folder in windows 7, can't remove file or folder in windows 7 , kind of things.

0 comments:

Post a Comment