New
#51
Dostka, that isn't an option with all drives.
Just to reiterate... under "normal" circumstances, this is solved using methods pointed out in posts 22 & 24 on page 3. Now, obviously there are certain things that must be disabled first (System Restore for target volume, for example), but it does work.
The other thing to note is that other programs may store info in there as well. For example, I just tried removing the "System Volume Information" (SVI going forward) folder off from an external drive of mine but had issues with a single file not wanting to delete no matter what I did. Process Explorer showed it as in use by the System process the moment I connected the drive. When I did some research on the file, I found it was actually being created by our Anti-virus program (Symantec Endpoint Protection 12.1) in use here. Now, while hooking the external up to another PC that does not have the AV does allow me to remove the SVI folder, no matter what I do to lock out permissions on the "place holder" SVI file, the AV is still able to gain control of it, rename it, and then recreate the normal SVI folder.
But, for those situations where you can delete the SVI folder and not have something else recreate it (*cough*Symantec*cough*)... here's a simple batch string that automates posts 22 & 24 that you can use to delete it:
Notes and commands explained:Code:takeown /f "X:\System Volume Information" /a /r /d y icacls "X:\System Volume Information\*" /grant:r administrators:F /t /l rmdir "X:\System Volume Information" /s /q *>"X:\System Volume Information"
- The file must be run as administrator (elevated permissions).
- Replace all "X:\" with your appropriate drive letter. You can also remove that if the .bat file is to be run only from the drive(s) you wish to remove the SVI folder from.
- "takeown" is used to force taking ownership of directories and/or files that you otherwise do not have permission to change ownership on. You will need this if you otherwise are unable to edit permissions. The switch "/a" grants the ownership to the administrators group. You can remove it so it grants ownership to the account in use. "/r" is so it works on all subdirectories and files. "/d y" is so it responds "yes" to any questions of (essentially) "are you sure you want to take ownership".
- "icacls" is used to make sure you have full control over everything. "/grant:r administrators:F" is used to grant full (":F") permissions to the "administrators" group while removing (":r") all other permission entries. I did this in case of a situation where you add administrators, but your user account is specifically listed as deny (seems that would take precedence). You can replace "administrators" with any user name or group that you feel appropriate for your situation. "/t" makes it work on all "matching" subdirectories and files. "/l" performs the operation on a symbolic link rather than the link's target.
- "rmdir" is used to delete the SVI directory. "/s" removes all subdirectories and files while "/q" suppresses the "are you sure" messages.
- The final line is meant simply to create a 0 byte, extension-less file by the same name as the normal SVI folder, thus preventing "normal" recreation of the folder and contents. As such, the "*" is used simply as an invalid command to be outputted (">") to the appropriate file and location.
While all of this does work, there are obviously caveats to it. If there is even 1 file or folder within it that is in use by something else, rmdir will fail. If there is something else that is monitoring the directory and has been setup to be able to take over your extension-less file to rename and recreate the folder, then you're hosed; you'll never be able to truly get rid of it.
Win some... lose some.