Cannot remove files on Windows

176

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.

Share:
176

Related videos on Youtube

a-ctor
Author by

a-ctor

Updated on September 18, 2022

Comments

  • a-ctor
    a-ctor over 1 year

    I am creating a .NET core (version 1.0.0-rc1-update1) console application with VS 2015 community (latest version). Building and running the app went fine until I wanted to use any System.IO type (can not use System.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 the project.json. The project itself is running with dnx 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 the System.IO and System.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
      Jeremy over 12 years
      Where are the files that you're trying to delete located?
    • DeadMG
      DeadMG over 12 years
      @JeremyBanks: A hard-drive plugged in to a SATA-2 port on the machine.
    • Paul
      Paul over 12 years
      Can you try changing the owner to yourself in the advanced permissions?
    • JdeBP
      JdeBP over 12 years
      Being 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
      DeadMG over 12 years
      @Paul: I did. No change.
    • DeadMG
      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
      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
      DeadMG over 12 years
      @MSalters: Yes, it does. My hard drive, my files, my rules.
    • Rob
      Rob over 12 years
      That's just... not even how it works.
    • bwDraco
      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
      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
      Rob over 12 years
      You also paid for windows, apparently. So yeah, that's what I'm telling you.
    • MSalters
      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
      mason about 8 years
      Do you have a using System at the top of your file?
    • a-ctor
      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
      Victor Hurdugaci about 8 years
      What 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
      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 the project.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
      Lex Li almost 8 years
      Changed the tags, as this discussion was about RC1. Users should now upgrade to RC2, dot.net
  • DeadMG
    DeadMG over 12 years
    I 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
    surfasb over 12 years
    Have you checked to see if permissions to Administrators have been denied? A good place to check is under the Effective permissions tab.
  • DeadMG
    DeadMG over 12 years
    Nope. It said success, but I still can't get rid of it.
  • DeadMG
    DeadMG over 12 years
    Yes, I have- they are granted.
  • DeadMG
    DeadMG over 12 years
    This worked for me and got rid of the files.
  • a-ctor
    a-ctor about 8 years
    I needed System.IO.FileSystem -.-
  • Lex Li
    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
    Patrick about 8 years
    This doesn't work. It says "Access is denied."
  • MSalters
    MSalters about 8 years
    @Patrick: Are you an administrator and did you take ownership?
  • Patrick
    Patrick about 8 years
    @MSalters yes and yes.