• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 922
  • Last Modified:

Delete file/folder

Are there any ways on how to delete a FOLDER or FILE that is EMPTY or CAN'T be accessed anynmore? The folder is located on the server and we would like to delete the folder. But we tried to delete it, but failed. We set FULL Option for Everyone already for that folder, but still failed to delete. Even renaming the folder doesn't work. We tried to delete it from the server, so its the Administrator account already, but still failed to delete.
Even delete it using DOS Prompt, no work.

Are there any options on how to delete this kind of folders or files?
Because I'm doing ROBOCOPY from the server, but stuck on that part, in whereas found problem with 1 file inside that folder.

Stiebel Eltron
Stiebel Eltron
1 Solution
ran into a similar problem today... went to the folder in DOS, and did a dir /x and that showed me the msdos name of the folder, then I typed rmdir <8characterfoldername> ... so if it's called tempor~1, then you'd type rmdir tempor~1.... hope this works for you
Things to try:

- Have you tried hitting refresh on the folder to see if it's already gone?

- Did you make sure the folder's properties aren't set to read-only

- You could try deleting the folder/file with some simple VBA code in an Excel workbook (see example sub procedure)

There's probably a better way to do it, but those are some starters you can try...

Sub DeleteFolder()
      Kill "C:\folder"
End Sub

Open in new window

Is this windows 2003 server? if so there is a tool called "takeown" that will allow you to take ownership of the folder and it's contents,and then delete it.  Curiously when I have set permission via the gui I was still not able to delete folders that I should have had permissions to delete. Not Server 2003?? boot into safemode, or off a dos bootdisk, navigate to the folder and make sure it is empty, you will not be able to delete the directory if it is not empty. In dos, or safe more you should be able to delete the folder safely.
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

HainKurtSr. System AnalystCommented:
what message you get when you try to delete or rename? what kind of files you have inside the folder?
is path too deep? does it contain special characters inside?
HainKurtSr. System AnalystCommented:
you can use dos "dir /x" to see the actual 8.3 dos name
call attrib -r-h-s FileIName83.format
then try to delete

if does not help, reboot and try again...

if does not help, reboot and open in SafeMode...

still no luck, try later :)
Check directory ownership, change directory owner ship to administrator account and then delete it. Also try to delete it using del /F which is forcefull delete.
deroodeSystems AdministratorCommented:
Any chance that the folder is in a path that is too long (> 238 characters)? I have seen problems where doing anything with files or folders in long paths is impossible. Usually this happens after renaming folders lower in the directory tree. When this is the case can rename folders that are lower in the directory tree to a shorter name.
QlemoBatchelor and DeveloperCommented:
If you already tried to the delete the folder, but it is locked by another program (e.g. as it's working or last accessed directory), you are stuck now. You only can try to kill the corresponding handle. Free tools to do that are handle (command line) or ProcExp (GUI), both from www.sysinternals.com (belongs to Microsoft now).

Stiebel EltronAuthor Commented:
If I want to delete the folder, it POP-UP an error message saying Make sure that the disk is not FULL or write-protected, and/or not in use by other. But no one is accessing that folder, and even the server can't delete that folder.

In ROBOCOPY, how can u skip a file that has problem? Bec. everytime it runs and found a file that can't be copied, it'll stuck there.
deroodeSystems AdministratorCommented:
With robocopy, use the Retry once, Wait one second option

Robocopy <source> <destination> /r:1 /w:1

Use robocopy /??? for most used options, read the accompanied documentation for all options.
Adam LeinssSenior Desktop EngineerCommented:
What's the name of the directory?  If it's something like COM, CON, AUX or has illegal charsacters, you will have to use special methods to delete it.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now