Can't delete a file on windows












0















Edit: Now, the situation seems to have fixed itself - I checked again - and the file is just gone. I removed the parent folder without any problems. I did literally nothing. I have no idea what is going on here.





I have no idea what happened with permissions to my file.
I created a file using VSCode in a git repository. Then, as far as I remember, I decided that it's of no use and decided to delete it using git that is installed under ubuntu using Windows Subsystem Linux with git reset --hard. Instead I got an error that access was denied. Now I have a file that, apparently, can survive anything. Trying to remove it gives me an error that I need a permission:



enter image description here



Trying to remove it from ubuntu makes it even funnier:



enter image description here



(note that I'm trying to remove a whole directory and it specifically complains that the file doesn't exist)



So I tried to change permissions to the file:



enter image description here



Clicking Continue yelds literally no effect.
Trying to change permissions to a containing folder complains that access was denied:



enter image description here



And trying to remove the parent folder says that I need permissions from... myself:



enter image description here



Do you have any idea what can I do to get rid of it? At some point I managed to remove a whole project folder. Cool. Then I cloned the repo again in the same place... and the file was there, marked as untracked by git (because I never added it to the repo). I'm lost.










share|improve this question

























  • "(note that I'm trying to remove a whole directory and it specifically complains that the file doesn't exist)" -- the OS doesn't have a function to remove a directory with its contents, so the command needs to remove the individual files first, and will be able to remove the directory only once it's empty. Doesn't make the actual error message any less weird though.

    – grawity
    Jan 25 at 13:37











  • @grawity -R option should remove contents recursively; and if the file doesn't exist then, logically, it should not pick it up at all. After all, why try to remove a file that doesn't exist at all, where I didn't even specify that it should be removed.

    – Michał Sadowski
    Jan 25 at 13:49











  • May be the file was in use? Opened in with other application, so it can not be deleted, since there is a handle that points to it... And after closing the app, the handle is released and the file is deleted. That is the only logical explanation I can come with.

    – nephewtom
    Jan 25 at 16:38











  • @nephewtom not really - I restarted the computer in the meantime and it didn't help with anything. Also, then it should just throw an error that the file is in use instead of giving cryptic messages.

    – Michał Sadowski
    Jan 28 at 9:53
















0















Edit: Now, the situation seems to have fixed itself - I checked again - and the file is just gone. I removed the parent folder without any problems. I did literally nothing. I have no idea what is going on here.





I have no idea what happened with permissions to my file.
I created a file using VSCode in a git repository. Then, as far as I remember, I decided that it's of no use and decided to delete it using git that is installed under ubuntu using Windows Subsystem Linux with git reset --hard. Instead I got an error that access was denied. Now I have a file that, apparently, can survive anything. Trying to remove it gives me an error that I need a permission:



enter image description here



Trying to remove it from ubuntu makes it even funnier:



enter image description here



(note that I'm trying to remove a whole directory and it specifically complains that the file doesn't exist)



So I tried to change permissions to the file:



enter image description here



Clicking Continue yelds literally no effect.
Trying to change permissions to a containing folder complains that access was denied:



enter image description here



And trying to remove the parent folder says that I need permissions from... myself:



enter image description here



Do you have any idea what can I do to get rid of it? At some point I managed to remove a whole project folder. Cool. Then I cloned the repo again in the same place... and the file was there, marked as untracked by git (because I never added it to the repo). I'm lost.










share|improve this question

























  • "(note that I'm trying to remove a whole directory and it specifically complains that the file doesn't exist)" -- the OS doesn't have a function to remove a directory with its contents, so the command needs to remove the individual files first, and will be able to remove the directory only once it's empty. Doesn't make the actual error message any less weird though.

    – grawity
    Jan 25 at 13:37











  • @grawity -R option should remove contents recursively; and if the file doesn't exist then, logically, it should not pick it up at all. After all, why try to remove a file that doesn't exist at all, where I didn't even specify that it should be removed.

    – Michał Sadowski
    Jan 25 at 13:49











  • May be the file was in use? Opened in with other application, so it can not be deleted, since there is a handle that points to it... And after closing the app, the handle is released and the file is deleted. That is the only logical explanation I can come with.

    – nephewtom
    Jan 25 at 16:38











  • @nephewtom not really - I restarted the computer in the meantime and it didn't help with anything. Also, then it should just throw an error that the file is in use instead of giving cryptic messages.

    – Michał Sadowski
    Jan 28 at 9:53














0












0








0








Edit: Now, the situation seems to have fixed itself - I checked again - and the file is just gone. I removed the parent folder without any problems. I did literally nothing. I have no idea what is going on here.





I have no idea what happened with permissions to my file.
I created a file using VSCode in a git repository. Then, as far as I remember, I decided that it's of no use and decided to delete it using git that is installed under ubuntu using Windows Subsystem Linux with git reset --hard. Instead I got an error that access was denied. Now I have a file that, apparently, can survive anything. Trying to remove it gives me an error that I need a permission:



enter image description here



Trying to remove it from ubuntu makes it even funnier:



enter image description here



(note that I'm trying to remove a whole directory and it specifically complains that the file doesn't exist)



So I tried to change permissions to the file:



enter image description here



Clicking Continue yelds literally no effect.
Trying to change permissions to a containing folder complains that access was denied:



enter image description here



And trying to remove the parent folder says that I need permissions from... myself:



enter image description here



Do you have any idea what can I do to get rid of it? At some point I managed to remove a whole project folder. Cool. Then I cloned the repo again in the same place... and the file was there, marked as untracked by git (because I never added it to the repo). I'm lost.










share|improve this question
















Edit: Now, the situation seems to have fixed itself - I checked again - and the file is just gone. I removed the parent folder without any problems. I did literally nothing. I have no idea what is going on here.





I have no idea what happened with permissions to my file.
I created a file using VSCode in a git repository. Then, as far as I remember, I decided that it's of no use and decided to delete it using git that is installed under ubuntu using Windows Subsystem Linux with git reset --hard. Instead I got an error that access was denied. Now I have a file that, apparently, can survive anything. Trying to remove it gives me an error that I need a permission:



enter image description here



Trying to remove it from ubuntu makes it even funnier:



enter image description here



(note that I'm trying to remove a whole directory and it specifically complains that the file doesn't exist)



So I tried to change permissions to the file:



enter image description here



Clicking Continue yelds literally no effect.
Trying to change permissions to a containing folder complains that access was denied:



enter image description here



And trying to remove the parent folder says that I need permissions from... myself:



enter image description here



Do you have any idea what can I do to get rid of it? At some point I managed to remove a whole project folder. Cool. Then I cloned the repo again in the same place... and the file was there, marked as untracked by git (because I never added it to the repo). I'm lost.







windows-10 file-permissions windows-subsystem-for-linux






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 25 at 13:53







Michał Sadowski

















asked Jan 25 at 13:23









Michał SadowskiMichał Sadowski

1011




1011













  • "(note that I'm trying to remove a whole directory and it specifically complains that the file doesn't exist)" -- the OS doesn't have a function to remove a directory with its contents, so the command needs to remove the individual files first, and will be able to remove the directory only once it's empty. Doesn't make the actual error message any less weird though.

    – grawity
    Jan 25 at 13:37











  • @grawity -R option should remove contents recursively; and if the file doesn't exist then, logically, it should not pick it up at all. After all, why try to remove a file that doesn't exist at all, where I didn't even specify that it should be removed.

    – Michał Sadowski
    Jan 25 at 13:49











  • May be the file was in use? Opened in with other application, so it can not be deleted, since there is a handle that points to it... And after closing the app, the handle is released and the file is deleted. That is the only logical explanation I can come with.

    – nephewtom
    Jan 25 at 16:38











  • @nephewtom not really - I restarted the computer in the meantime and it didn't help with anything. Also, then it should just throw an error that the file is in use instead of giving cryptic messages.

    – Michał Sadowski
    Jan 28 at 9:53



















  • "(note that I'm trying to remove a whole directory and it specifically complains that the file doesn't exist)" -- the OS doesn't have a function to remove a directory with its contents, so the command needs to remove the individual files first, and will be able to remove the directory only once it's empty. Doesn't make the actual error message any less weird though.

    – grawity
    Jan 25 at 13:37











  • @grawity -R option should remove contents recursively; and if the file doesn't exist then, logically, it should not pick it up at all. After all, why try to remove a file that doesn't exist at all, where I didn't even specify that it should be removed.

    – Michał Sadowski
    Jan 25 at 13:49











  • May be the file was in use? Opened in with other application, so it can not be deleted, since there is a handle that points to it... And after closing the app, the handle is released and the file is deleted. That is the only logical explanation I can come with.

    – nephewtom
    Jan 25 at 16:38











  • @nephewtom not really - I restarted the computer in the meantime and it didn't help with anything. Also, then it should just throw an error that the file is in use instead of giving cryptic messages.

    – Michał Sadowski
    Jan 28 at 9:53

















"(note that I'm trying to remove a whole directory and it specifically complains that the file doesn't exist)" -- the OS doesn't have a function to remove a directory with its contents, so the command needs to remove the individual files first, and will be able to remove the directory only once it's empty. Doesn't make the actual error message any less weird though.

– grawity
Jan 25 at 13:37





"(note that I'm trying to remove a whole directory and it specifically complains that the file doesn't exist)" -- the OS doesn't have a function to remove a directory with its contents, so the command needs to remove the individual files first, and will be able to remove the directory only once it's empty. Doesn't make the actual error message any less weird though.

– grawity
Jan 25 at 13:37













@grawity -R option should remove contents recursively; and if the file doesn't exist then, logically, it should not pick it up at all. After all, why try to remove a file that doesn't exist at all, where I didn't even specify that it should be removed.

– Michał Sadowski
Jan 25 at 13:49





@grawity -R option should remove contents recursively; and if the file doesn't exist then, logically, it should not pick it up at all. After all, why try to remove a file that doesn't exist at all, where I didn't even specify that it should be removed.

– Michał Sadowski
Jan 25 at 13:49













May be the file was in use? Opened in with other application, so it can not be deleted, since there is a handle that points to it... And after closing the app, the handle is released and the file is deleted. That is the only logical explanation I can come with.

– nephewtom
Jan 25 at 16:38





May be the file was in use? Opened in with other application, so it can not be deleted, since there is a handle that points to it... And after closing the app, the handle is released and the file is deleted. That is the only logical explanation I can come with.

– nephewtom
Jan 25 at 16:38













@nephewtom not really - I restarted the computer in the meantime and it didn't help with anything. Also, then it should just throw an error that the file is in use instead of giving cryptic messages.

– Michał Sadowski
Jan 28 at 9:53





@nephewtom not really - I restarted the computer in the meantime and it didn't help with anything. Also, then it should just throw an error that the file is in use instead of giving cryptic messages.

– Michał Sadowski
Jan 28 at 9:53










1 Answer
1






active

oldest

votes


















0














You likely need to take ownership of the file - current ownership is probably SYSTEM or something, which you need to change to your user (andministrator) account.



Bring up the file Properties box, then the security tab, then click the "Advanced" linkbutton. That window will tell you who the current owner is, and there is another linkbutton there to change this. (You can see this linkbutton in your screenshot above)






share|improve this answer


























  • I wish! If you take a look at this image: i.stack.imgur.com/uUhfg.png I tried to do exactly that, but apparently I don't even have permissions to see the permissions.

    – Michał Sadowski
    Jan 25 at 13:35











  • @Michał-Sadowski - Are you sure you're using an administrator account? And the error you refer to is with the "Continue" button - do you also get this with the "Change" (owner) one above?

    – PSU
    Jan 25 at 13:46













  • I'm sure. Now, the situation seems to have fixed itself - I checked again - and the file is just gone. I removed the parent folder without any problems. I did literally nothing. I have no idea what is going on here.

    – Michał Sadowski
    Jan 25 at 13:52






  • 1





    It's just your computer messing with you. They do that. :)

    – PSU
    Jan 25 at 13:53











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1398362%2fcant-delete-a-file-on-windows%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














You likely need to take ownership of the file - current ownership is probably SYSTEM or something, which you need to change to your user (andministrator) account.



Bring up the file Properties box, then the security tab, then click the "Advanced" linkbutton. That window will tell you who the current owner is, and there is another linkbutton there to change this. (You can see this linkbutton in your screenshot above)






share|improve this answer


























  • I wish! If you take a look at this image: i.stack.imgur.com/uUhfg.png I tried to do exactly that, but apparently I don't even have permissions to see the permissions.

    – Michał Sadowski
    Jan 25 at 13:35











  • @Michał-Sadowski - Are you sure you're using an administrator account? And the error you refer to is with the "Continue" button - do you also get this with the "Change" (owner) one above?

    – PSU
    Jan 25 at 13:46













  • I'm sure. Now, the situation seems to have fixed itself - I checked again - and the file is just gone. I removed the parent folder without any problems. I did literally nothing. I have no idea what is going on here.

    – Michał Sadowski
    Jan 25 at 13:52






  • 1





    It's just your computer messing with you. They do that. :)

    – PSU
    Jan 25 at 13:53
















0














You likely need to take ownership of the file - current ownership is probably SYSTEM or something, which you need to change to your user (andministrator) account.



Bring up the file Properties box, then the security tab, then click the "Advanced" linkbutton. That window will tell you who the current owner is, and there is another linkbutton there to change this. (You can see this linkbutton in your screenshot above)






share|improve this answer


























  • I wish! If you take a look at this image: i.stack.imgur.com/uUhfg.png I tried to do exactly that, but apparently I don't even have permissions to see the permissions.

    – Michał Sadowski
    Jan 25 at 13:35











  • @Michał-Sadowski - Are you sure you're using an administrator account? And the error you refer to is with the "Continue" button - do you also get this with the "Change" (owner) one above?

    – PSU
    Jan 25 at 13:46













  • I'm sure. Now, the situation seems to have fixed itself - I checked again - and the file is just gone. I removed the parent folder without any problems. I did literally nothing. I have no idea what is going on here.

    – Michał Sadowski
    Jan 25 at 13:52






  • 1





    It's just your computer messing with you. They do that. :)

    – PSU
    Jan 25 at 13:53














0












0








0







You likely need to take ownership of the file - current ownership is probably SYSTEM or something, which you need to change to your user (andministrator) account.



Bring up the file Properties box, then the security tab, then click the "Advanced" linkbutton. That window will tell you who the current owner is, and there is another linkbutton there to change this. (You can see this linkbutton in your screenshot above)






share|improve this answer















You likely need to take ownership of the file - current ownership is probably SYSTEM or something, which you need to change to your user (andministrator) account.



Bring up the file Properties box, then the security tab, then click the "Advanced" linkbutton. That window will tell you who the current owner is, and there is another linkbutton there to change this. (You can see this linkbutton in your screenshot above)







share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 25 at 13:39

























answered Jan 25 at 13:33









PSUPSU

11




11













  • I wish! If you take a look at this image: i.stack.imgur.com/uUhfg.png I tried to do exactly that, but apparently I don't even have permissions to see the permissions.

    – Michał Sadowski
    Jan 25 at 13:35











  • @Michał-Sadowski - Are you sure you're using an administrator account? And the error you refer to is with the "Continue" button - do you also get this with the "Change" (owner) one above?

    – PSU
    Jan 25 at 13:46













  • I'm sure. Now, the situation seems to have fixed itself - I checked again - and the file is just gone. I removed the parent folder without any problems. I did literally nothing. I have no idea what is going on here.

    – Michał Sadowski
    Jan 25 at 13:52






  • 1





    It's just your computer messing with you. They do that. :)

    – PSU
    Jan 25 at 13:53



















  • I wish! If you take a look at this image: i.stack.imgur.com/uUhfg.png I tried to do exactly that, but apparently I don't even have permissions to see the permissions.

    – Michał Sadowski
    Jan 25 at 13:35











  • @Michał-Sadowski - Are you sure you're using an administrator account? And the error you refer to is with the "Continue" button - do you also get this with the "Change" (owner) one above?

    – PSU
    Jan 25 at 13:46













  • I'm sure. Now, the situation seems to have fixed itself - I checked again - and the file is just gone. I removed the parent folder without any problems. I did literally nothing. I have no idea what is going on here.

    – Michał Sadowski
    Jan 25 at 13:52






  • 1





    It's just your computer messing with you. They do that. :)

    – PSU
    Jan 25 at 13:53

















I wish! If you take a look at this image: i.stack.imgur.com/uUhfg.png I tried to do exactly that, but apparently I don't even have permissions to see the permissions.

– Michał Sadowski
Jan 25 at 13:35





I wish! If you take a look at this image: i.stack.imgur.com/uUhfg.png I tried to do exactly that, but apparently I don't even have permissions to see the permissions.

– Michał Sadowski
Jan 25 at 13:35













@Michał-Sadowski - Are you sure you're using an administrator account? And the error you refer to is with the "Continue" button - do you also get this with the "Change" (owner) one above?

– PSU
Jan 25 at 13:46







@Michał-Sadowski - Are you sure you're using an administrator account? And the error you refer to is with the "Continue" button - do you also get this with the "Change" (owner) one above?

– PSU
Jan 25 at 13:46















I'm sure. Now, the situation seems to have fixed itself - I checked again - and the file is just gone. I removed the parent folder without any problems. I did literally nothing. I have no idea what is going on here.

– Michał Sadowski
Jan 25 at 13:52





I'm sure. Now, the situation seems to have fixed itself - I checked again - and the file is just gone. I removed the parent folder without any problems. I did literally nothing. I have no idea what is going on here.

– Michał Sadowski
Jan 25 at 13:52




1




1





It's just your computer messing with you. They do that. :)

– PSU
Jan 25 at 13:53





It's just your computer messing with you. They do that. :)

– PSU
Jan 25 at 13:53


















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1398362%2fcant-delete-a-file-on-windows%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Plaza Victoria

In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...