Some folders in a file-processing share refuse to delete, and even ownership and permission changes return access denied. The service account normally has read, write, and delete access. What should I check before trying a more forceful deletion?
How do I delete stubborn folders on a Windows file server?
Answers
Check the full path and folder names first. Very long paths or unusual characters can make a folder look like a permissions problem when the tool is actually struggling to address it. Try working locally on the server rather than through the share, since share permissions and file permissions are separate checks.
Reply to this answer
Robocopy can mirror an empty directory into the stubborn directory, which may clear contents that ordinary deletion tools struggle with. It is destructive: check the source and destination paths carefully, and make sure the destination contains nothing you need. It is not a guaranteed bypass for permissions or open handles.
Reply to this answer
Look for open handles before assuming the ACL is the whole story. Computer Management can show open shared files, while Sysinternals Handle or Process Explorer can help identify local processes holding paths open. A file that is already pending deletion may remain until its last handle closes.
If you find a handle, identify the process and coordinate closing it rather than killing or disconnecting it blindly. That could interrupt the processing workload.
Reply to this answer
I'd also trace how those folders are created. Check whether the processing scripts or another system writing to the share set unusual permissions or attributes. Inspect the parent folder's security descriptor and inheritance settings, not just the child that refuses access.
If the share is backed by a storage appliance rather than a native Windows volume, check its management tools and permissions too. The Windows share view may not tell the whole story.
Reply to this answer
There isn't a safe universal delete switch that ignores every cause of access denied. Offline cleanup is another option, but it requires downtime and care around the affected volume. Wiping a disk would be far more destructive than deleting these folders, so that is not a sensible fix for this problem.
ruler.with.no.rush:
The processing runs around the clock, so taking the server offline isn't currently an option.
Reply to this answer
Add your answer
Answers are reviewed before publication.
ruler.with.no.rush:
The troublesome folders have unusually long generated names, so path length is worth checking.