Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Can't delete file - Can't access folder

31 Jul 2015   #1
Calab

Windows 7 Pro 64bit
 
 
Can't delete file - Can't access folder

Running Windows 7 Pro with Microsoft Security Essentials as my antivirus...

In my D:\TEMP folder there is a folder named CR_98F43.tmp. If I try to go into that folder I am denied permission. I'm told that I need to use the security tab to gain access. If I go to the folder properties, into the security tab, everything is greyed out... I can't alter anything.

I'm able to access the content of the folder in an Administrator command prompt. Inside this directory is a file named "SETUP_PATCH.PACKED.7Z". I cannot delete this file from the command line. I've even tried a utility named "BootDelete" to try and delete the directory without success.

What can I do to remove this file and folder?


My System SpecsSystem Spec
.
31 Jul 2015   #2
Pyprohly

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
 
 

Hi Calab,

You can tell us the permission settings of the outer most item you are denied access from.

Open a PowerShell session, run the below line and post it's output here for us.
Code:
"D:\TEMP" | %{$a = Get-Acl $_} ; ''; $env:Username; $a.Owner; ''; $a.AccessToString
My System SpecsSystem Spec
01 Aug 2015   #3
Calab

Windows 7 Pro 64bit
 
 

Quote   Quote: Originally Posted by Pyprohly View Post
Hi Calab,

You can tell us the permission settings of the outer most item you are denied access from.

Open a PowerShell session, run the below line and post it's output here for us.
Code:
"D:\TEMP" | %{$a = Get-Acl $_} ; ''; $env:Username; $a.Owner; ''; $a.AccessToString
Opened Powershell:
Code:
PS D:\> "D:\TEMP" | %{$a = Get-Acl $_} ; ''; $env:Username; $a.Owner; ''; 
$a.AccessToString
 
Steve
StevesPC\Steve
 
Everyone Allow  -1
PS D:\>
PS D:\> "D:\TEMP\CR_98F43.tmp" | %{$a = Get-Acl $_} ; ''; $env:Username; $a.Owner; ''; $a.AccessToString
Get-Acl : Attempted to perform an unauthorized operation.
At line:1 char:40
+ "D:\TEMP\CR_98F43.tmp" | %{$a = Get-Acl <<<<  $_} ; ''; $env:Username; $a.Owner; ''; $a.AccessToString
    + CategoryInfo          : NotSpecified: (:) [Get-Acl], UnauthorizedAccessException
    + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.GetAclCommand
 
Steve
StevesPC\Steve
Everyone Allow  -1
PS D:\>
Opened Powershell as administrator:
Code:
PS D:\> "D:\TEMP\CR_98F43.tmp" | %{$a = Get-Acl $_} ; ''; $env:Username; $a.Owner; ''; $a.AccessToString
Steve
NT AUTHORITY\SYSTEM
NT AUTHORITY\SYSTEM Allow  FullControl
BUILTIN\Administrators Allow  ReadAndExecute, Synchronize
PS D:\>
PS D:\temp\CR_98F43.tmp> "D:\TEMP\CR_98F43.tmp\SETUP_PATCH.PACKED.7Z" | %{$a = Get-Acl $_} ; ''; $env:Username; $a.Owner
; ''; $a.AccessToString
Steve
NT AUTHORITY\SYSTEM
NT AUTHORITY\SYSTEM Allow  FullControl
BUILTIN\Administrators Allow  ReadAndExecute, Synchronize
PS D:\temp\CR_98F43.tmp>
When I attempt to delete the file, in Powershell as administrator:
Code:
PS D:\temp\CR_98F43.tmp> del .\SETUP_PATCH.PACKED.7Z
Remove-Item : Cannot remove item D:\temp\CR_98F43.tmp\SETUP_PATCH.PACKED.7Z: Access to the path 'D:\temp\CR_98F43.tmp\S
ETUP_PATCH.PACKED.7Z' is denied.
At line:1 char:4
+ del <<<<  .\SETUP_PATCH.PACKED.7Z
    + CategoryInfo          : PermissionDenied: (D:\temp\CR_98F4...PATCH.PACKED.7Z:FileInfo) [Remove-Item], Unauthoriz
   edAccessException
    + FullyQualifiedErrorId : RemoveFileSystemItemUnAuthorizedAccess,Microsoft.PowerShell.Commands.RemoveItemCommand
My System SpecsSystem Spec
.

01 Aug 2015   #4
Calab

Windows 7 Pro 64bit
 
 

One item I should mention is that my %TEMP% and %TMP% variables point to E:\Temp. Nothing should be using D:\Temp. I moved my temp directory to a dedicated drive last week, as I had a small spare SSD laying around.
My System SpecsSystem Spec
01 Aug 2015   #5
paul1149

Linux Lite 2.8 x64 (full-featured, fast, rock-solid)
 
 

Would it be cheating to pop in a linux boot stick and give it a try? DSL is a mere 50MB download.
My System SpecsSystem Spec
01 Aug 2015   #6
paul1149

Linux Lite 2.8 x64 (full-featured, fast, rock-solid)
 
 

Actually I wouldn't recommend DSL. It requires too much work to set up. Puppy or LinuxLite would be a better choice.
My System SpecsSystem Spec
02 Aug 2015   #7
Calab

Windows 7 Pro 64bit
 
 

Finally got it fixed...

1- Boot into safe mode (not sure if it was necessary)
2- Open PowerShell as administrator
3- Used TAKEOWN to take ownership of the 7z file
4- Went to the properties of the file in Windows Explorer
5- I was able to give myself full control of the file
6- Deleted the file.

Tada!
My System SpecsSystem Spec
Reply

 Can't delete file - Can't access folder




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Unable to Delete Folder from Desktop: Access Is Denied?
I had a folder on my Desktop that just won't delete. It was apparently being shared with my Xbox360. I right-clicked it, pressed Delete, and it said it was being shared and if I was sure I wanted to do it anyways. So, of course, I said Yes. It deleted everything within the folder, yet the folder...
Software
Can't delete folder - access denied
Hello! I have a small issue concerning deleting folder. Here's situation: I had a folder that I wanted to delete. I used shift+del combo for instant deletion, but than issue occured. Basicly, folder stayed, yet files deleted themselves. And when I try to delete the folder, it says I need...
General Discussion
Delete file/folder bug??
Hi, This is a strange issue, i know, but it has happened to me at least 4 times on 2 different machines, with different hardware, one with Win7 x64 Premium, the other Win7 x32 Pro. Lets say you have 20 files and folders inside the Downloads folder. What has happened to me is that I was...
General Discussion
Can't delete folder - access denied (despite attempts to fix)
I'm trying to delete an obsolete directory. When I try to do so, I get a message "Folder access denied: You require permission from Administrators to make changes to this folder." Based on forum advice for a similar problem that worked in the past, I did the following: Right-click the...
System Security
I cannot delete a particular file Access Denied
I am tryiong to save, delete or overwrite the file "Clear Print Spooler.bat" in C;\windows\system32 and in each case get "ACCESS Denied" error. I have tried the above in the command window with admin. priviledge. Same error. I had added a line that contained the word "Runas". Now I try to remove...
Security Basics
Can't delete a file - Access is denied
Hi, I have a compiled .dll file that I want to delete - but I can't do it in any way. I already tried del command line and take ownership (both GUI and cmd) but nothing helped so far. I always get the Access is denied error. Any idea will be appreciated! Thanks, Shaorn
General Discussion


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 12:50.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App