Cannot remove files on Windows
Solution 1
I would recommend using "Unlocker" http://www.emptyloop.com/unlocker/
It is a program just for that, it releases the files and can execute any action on them like deleting them.
Once installed, you just have to "right click" on the file/directory you want to delete and use the asistant to delete them.
Solution 2
A command-line solution could be icacls <filename> /reset
. If you need to take control first (it appears you already did), that would be icacls <filename> /setowner <newowner>
. In that case, <newowner>
should be your accountname, and of course be an Administrator.
Solution 3
As said by Paul, you'll need to take ownership of the files to change the permissions.
Right click the files and go to the Security Tab. Click Advanced and then to owner. Change Ownership to the Administrators group.
Solution 4
Make a liveCD of a linux/unix environment, mount your hard drive, and delete the files. There's no reason this shouldn't work.
Related videos on Youtube
a-ctor
Updated on September 18, 2022Comments
-
a-ctor over 1 year
I am creating a
.NET core
(version1.0.0-rc1-update1
) console application with VS 2015 community (latest version). Building and running the app went fine until I wanted to use anySystem.IO
type (can not useSystem.Threading
types either).The name 'File' does not exist in the current context
I added the
System.IO
package with NPM and it added it to the dependency in theproject.json
. The project itself is running withdnx
but Visual Studio can not build it.project.json
{ "version": "1.0.0-*", "description": "", "authors": [ "Widi" ], "tags": [ "" ], "projectUrl": "", "licenseUrl": "", "compilationOptions": { "emitEntryPoint": true }, "dependencies": { "OfcCore": "1.0.0-*", "System.IO": "4.0.11-beta-23516", "System.Text.RegularExpressions": "4.0.11-beta-23516" }, "commands": { "Ofc": "Ofc" }, "frameworks": { "dnx451": { }, "dnxcore50": { "dependencies": { "Microsoft.CSharp": "4.0.1-beta-23516", "System.Collections": "4.0.11-beta-23516", "System.Console": "4.0.0-beta-23516", "System.Linq": "4.0.1-beta-23516", "System.Threading": "4.0.11-beta-23516" } } } }
How do I get my project to also build and run in VS?
edit: If I remove
dnxcore50
VS builds like normal. It also seems like it can only not find theSystem.IO
andSystem.Threading
packages.System.Text.RegularExpressions
works fine. Is there any special dependency I am missing?Notes:
- VS Community 14.0.24720.00 Update 1
- ASP .NET and Web Tools 2015 (RC1 Update 1)
-
Jeremy over 12 yearsWhere are the files that you're trying to delete located?
-
DeadMG over 12 years@JeremyBanks: A hard-drive plugged in to a SATA-2 port on the machine.
-
Paul over 12 yearsCan you try changing the owner to yourself in the advanced permissions?
-
JdeBP over 12 yearsBeing a local administrator on a Windows NT system is not the same as being a superuser on a Unix or Linux system. For instance: The idea that as a local administrator you have full access to everything, is false. Unlearn that falsehood.
-
DeadMG over 12 years@Paul: I did. No change.
-
DeadMG over 12 years@JdeBP: There is no non-local administrator. Therefore, by default, I am the highest authority, as there is no other authority.
-
MSalters over 12 years@DeadMG: That's true, but that only means that you can claim ownership of everything. It doesn't mean you have all rights.
-
DeadMG over 12 years@MSalters: Yes, it does. My hard drive, my files, my rules.
-
Rob over 12 yearsThat's just... not even how it works.
-
bwDraco over 12 years@DeadMG, an account called Local System has full access to the system. It is not intended for use by the user, but is instead used by essential Windows services and other programs (such as security software) that require full system access. There are ways the user can gain Local System access, but this is not intended and can be very dangerous, just as using
root
on Unix and Unix-like systems for purposes other than system administration can be dangerous. -
DeadMG over 12 years@Rob: I physically own the hard drive. Are you telling me that I paid for a CPU, hard drive, etc, and then don't own it?
-
Rob over 12 yearsYou also paid for windows, apparently. So yeah, that's what I'm telling you.
-
MSalters over 12 years@DeadMG: You can't write to a file that's marked Read-Only, either, no matter that you paid for a writeable disk. Of course, that too is just a matter of flipping the right bits, just like file ownership.
-
mason about 8 yearsDo you have a
using System
at the top of your file? -
a-ctor about 8 years@mason on top my cs files - yes VS highlights the types and I also get AC but it is just not building in VS
-
Victor Hurdugaci about 8 yearsWhat do you mean you added the packages with NPM? What VS version are you using (the version is in Help -> About)? Also, from the same About box, share the version of Web dev tools
-
a-ctor about 8 years@VictorHurdugaci You can add the packages either via NPM, which writes the config to the
project.json
, or you can edit theproject.json
manually. I added them with NPM to make sure they have the latest version. I also edited my question to include product versions. -
Lex Li almost 8 yearsChanged the tags, as this discussion was about RC1. Users should now upgrade to RC2, dot.net
-
DeadMG over 12 yearsI did that, and the change seems to have taken effect, but I still can't change the permissions or delete the files. It says that Administrators are the owner and have all the permissions, but I still can't do anything.
-
surfasb over 12 yearsHave you checked to see if permissions to Administrators have been denied? A good place to check is under the Effective permissions tab.
-
DeadMG over 12 yearsNope. It said success, but I still can't get rid of it.
-
DeadMG over 12 yearsYes, I have- they are granted.
-
DeadMG over 12 yearsThis worked for me and got rid of the files.
-
a-ctor about 8 yearsI needed
System.IO.FileSystem
-.- -
Lex Li about 8 years@Widi yep. They split large namespaces like System.IO to multiple NuGet packages, so without the search engine it would be quite difficult to find out which to use.
-
Patrick about 8 yearsThis doesn't work. It says "Access is denied."
-
MSalters about 8 years@Patrick: Are you an administrator and did you take ownership?
-
Patrick about 8 years@MSalters yes and yes.