I have a folder (cygwin) in my Program Files directory that can not be deleted. I am the administrator, and also the system administrator and still cannot delete the folder. I have tried deleting it with the command prompt (running it as administrator) and still cannot delete the folder. Is there any super be-all end-all way to delete this folder?
try to do this in cmd:
go to the cd where the folder is (example desktop)
cd desktop
attrib -s -h -r cygwin
cacls cygwin /e /c /g %username%:f
after that go to the cd were the folder his and try this
cd cygwin
del *.* /s /q
cd..
rd cygwin /s /q
I hope it works!
It's not clear whether what methods you've already used, but perhaps from an administrator command prompt you could try running "rd /s" on it? This would remove any subdirectories and files that might be hidden or set as system files that would otherwise prevent a delete.
I had the same issue, the folder was owned by a user that is not on my system. I don't claim to understand how that happened, but here is how I was able to finally remove the files.
First I had broken my cygwin install with previous delete commands, so I actually re-installed enough packages to have the terminal again. Then launched the terminal with administrator privileges and from cygwin prompt ran:
cd /cygdrive/c
chown -R `whoami` cygwin
This gave my current windows user the permissions to the folder and I was able to delete.
Related
I can't delete Cygwin in my Windows 10 setup. I narrowed it down and the file that's causing trouble is
C:\cygwin\usr\share\avogadro\crystals\zeolites\CON.cif
In my case why the cywin directory (folder) cannot be deleted was due to "access privilege". To delete the folder, the user needs to "take ownership" of this folder. It cannot be done easily in Windows GUI. It is, however, fairly easy to achieve in a command prompt window using three command lines.
I followed the steps posted in this link. Remeber to be very sure what you are doing. Take note that the command prompt DOS window must be opened as "administrator". What this link says:
Open DOS Window "cmd.exe" as "administrator". Issue to the command prompt the following lines:
takeown /f "c:\cygwin" /r /d Y
The last parameter makes takeown assume "yes" to all questions and depends on locale. In the author's locale he/she had to answer "J" to make it work.
icacls "c:\cygwin" /T /Q /C /reset
Finally, to delete the files after we got the relevant permissions:
rd "c:\cygwin" /s /q
This method should work as intended in Windows 7 and above. I tried it in Windows7-x64 and Windows10-x64.
Running the following in command prompt as Administrator helped me:
C:\>del \\?\C:\cygwin64\usr\share\avogadro\crystals\zeolites
\\?\C:\cygwin64\usr\share\avogadro\crystals\zeolites\*, Are you sure (Y/N)? Y
I know this is a bit late but I like it:
If you have Linux subsystem installed (I have Ubuntu 18.04), you can remove that file via bash without any of the above. Just do,
Win+r -> bash -> cd /mnt/c/cygwin64/usr/share/avogadro/crystals/zeolites -> rm CON.cif.
Problem with cmd.exe and explorer.exe are that they are Windows' programs, whereas bash is not. In a way, this is the same as Lucian's answer because it makes the computer consider the file as a regular file.
Here it worked referring to PowerShell To Set Folder Permissions:
replace <User_with_administrator>
$mypath = ".\cygwin64--TO-BE-DELETED"
$myacl = Get-Acl $mypath
$myaclentry = "<User_with_administrator>","FullControl","Allow"
$myaccessrule = New-Object System.Security.AccessControl.FileSystemAccessRule($myaclentry)
$myacl.SetAccessRule($myaccessrule)
Get-ChildItem -Path "$mypath" -Recurse -Force | Set-Acl -AclObject $myacl -Verbose
Then the .\cygwin64--TO-BE-DELETED can be deleted.
I saw this in a github repo. It's a laravel related configuration.
Ensure permissions in storage folder has write access.
$ chmod -R 755 storage
$ chown www-data:www-data -Rf storage
I'm using windows, do I have to do the above command?
A simple referencing would be from Laravel permission issue in windows
However, in windows, referencing the post here:
If I wanted to take control of my Program Files folder, I'd need to enter the following:
takeown /f "C:\Program Files" /r /d y
icacls "C:\Program Files" /grant christian:F /t /q
I have not really tested this on my system, but I found at least two reference pages where this is used. Just change the path to the directory, and also notice that /r means recursively just like -R for linux system.
Hope this helps :)
I just installed the new LibreOffice version, but it failed because it couldn't delete the program folder in "C:\Program Files (x86)\LibreOffice 5", so I tried removing it with the Explorer and admin CMD, didn't work. Then I opened a System command prompt with psExec -i -s cmd and tried some commands on the folder:
rd /s program
takeown /r /f program
icacls program
Every command failed with "Access denied", so how do I remove it? I know that I could just ignore the windows permission system with a Linux distribution, but that's too much effort just for removing a folder.
I would suggest using the windows uninstall tool. If for some reason you can't do that try open cmd as admin and then type rd C:\Program Files (x86)\LibreOffice 5
I have a folder without any file in it in my external hard. I am able to rename it, but not able to delete it. I ran CMD utility as an administrator and I tried the commands "del foldername", "rd foldername", "deltree foldername" (the last one was not allowed in Windows XP). They give me the message "Access is denied." for "rd foldername". How can I delete it?
I am not cmd guru, but simple as 1-2-3 is delete folder using system account.
at 11:11pm /interactive cmd
Now if system command appear, delete folder:
del foldername
try
attrib /s foldername
This should show you the directory attributes.
If the response is
R x:\dirname
then the directory is "read-only". In that case, execute
attrib -r foldername
and you should then be able to rd it.
It may be that the directory has (possibly hidden, possibly read-only) contents. The attrib /s should show these to you.
I have a script that runs in WinPE that takes a system drive with Windows installed and deletes everything off of the drive (keeping the filesystem intact).
When dealing with a Windows XP/Vista/7 installation it functions properly. attrib -S -A -H -I -R /S /D \ is run, and then everything is deleted.
However, within Windows 8, I run into an "Access Denied" error. For some reason, even as the SYSTEM user within WinPE, I can't edit the directory C:\ProgramData\Microsoft\Windows\LocationProvider. I can't use attrib to set attributes, I can't delete it - I can't even cd into it! dir /a just returns File Not Found.
Using rmdir /S /Q gives me the "Access Denied" error.
Assuming that the problem is related to permissions and/or ownership, you can work around it using the built-in robocopy tool - luckily, this is included in Windows PE.
First, create an empty directory, e.g., x:\empty and then run
robocopy /e /purge /b x:\empty c:\
The /b flag tells robocopy to use backup mode, which bypasses security.
Had the same problem. You need to take ownership first, for example using takeown.exe. Then fix permissions, for example using icacls.exe. Then proceed as you wish with copy, move, delete.