6

When removing recursively a directory in PowerShell I've got:

Remove-Item W:\x -recurse

Remove-Item : Cannot remove item W:\x\y\z\Thumbs.db: You do not have sufficient access rights to perform this operation.

The directory tree removed contained more files, but only Thumbs.db is problematic.

My user is Domain Admin.

How to work through this with a minimal change to system?

EDIT Cannot find which explorer.exe locks the Thumbs.db. This is a multi-user remote desktop server and I really can neither reboot it nor log every user out.

Process Explorer Search for W:

2
7

Powershell needs -force to delete Thumbs.db, like this:

Remove-Item "W:\" -include "thumbs.db" -recurse -force

As an important side note, I've learned that since Windows 7 explorer doesn't create Thumbs.db inside folders on my local disks, only on remote network locations.

2
0

You should kill explorer.exe before doing this because explorer creates these files. Also dont try deleting it using powershell or cmd. Better remove it using Cygwin or delete all pictures first and then the directory itself. You may need to refresh the directory in explorer.

Also check the folder options of explorer if there is anything checked related to miniature images.

-2

Thumbs.db is one of these files created automatically by Windows (probably this is a collection of picture miniature that you can see when you open a directory containing pictures, it can show instead of an Icon, a miniature of the pictures in it) is considered a System File. So that only a Windows Administrator are allowed to change or delete it. Well, in old Windows, it was easily done, but starting from Win7 and so on, Windows are closing those "windows" of insecurity, making us System Programmer go wild tryin to accomplish some tasks. All said, you must activate the System Administrator account, and make these task using that Login.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.