Solved

Cannot delete a folder and its sub-folders

Posted on 2014-02-04
8
515 Views
Last Modified: 2014-02-26
Hi:

One of the apps I use created a folder and then countless sub folders with the same name, and I cannot find a way to delete them.

My folders look like: C:\ParentFolder\folderToDel\folderToDel\folderToDel.......\folderToDel

From Windows Explorer, I go to C:\ParentFolder, click on the folder and hit delete, 'yes', 'Yes to All', and I get "Cannot remove folder xxx: the directory is not empty" error message.
I tried drill down to the last folder I can get to and hit delete, nothing happened.

I also tried remove them from the command prompt, but got "The system cannot find the patch specified." error.

Please help. I use Windows XP.
0
Comment
Question by:sdc248
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 10

Expert Comment

by:WayneATaylor
ID: 39834181
My guess would be there are hidden or system files in the directories or if it's an ntfs drive it might be a permissions issue.

From a file window go to the folder options setting and turn on viewing hidden files and also turn off hide system files.   That should then show files.

If it's a permissions thing, you might need to go to the top level and right click/properties then reset permissions and sort to also reset child folders

Wayne
0
 

Author Comment

by:sdc248
ID: 39834248
Tried the folder options.  Still not seeing any hidden (system) files.

The Permissions button in Properties is grey-out for me.
0
 
LVL 3

Expert Comment

by:ola_erik
ID: 39834258
Hmm, I don't remember the phrasing of specific error messages but here is something:

restart your machine and try again

you should be able to delete directories in spite of them having files in them, sometimes an application has locked an open file. If it's extra cumbersome, you have an autostarted app or service running from your folders and the files themselves are hidden, as previously mentioned.

get "process explorer"
go to "find" in the menu
type some unique part of the folder name
if a file in that path is open it will list
you can see what process is blocking
kill that process in process exlorer or taskmanager
delete the folders

contemplate uninstalling the process/ app/ service now referencing an non-existant file

------------

you might have some damaged files/ folders
you might try run chkdsk to find out/ repair
0
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
LVL 35

Expert Comment

by:Dan Craciun
ID: 39834356
You've run into a large path (over 255 characters) which gives Windows problems.
It has various solutions:
- Map a drive to a folder in the structure of the path and delete from that point on, then delete the mapping and delete the rest of the folder
- rename each directory to a single character until the path is short enough to delete
- cut the folder in explorer and then paste it into the recycle bin
- use robocopy (solution taken from here):

To delete the directory tree starting at c:\subdir\more\offending_dir:

cd c:\subdir\more to cd into its parent directory.
mkdir empty to create an empty directory.
robocopy empty offending_dir /mir to mirror the empty directory into the offending one.
After some waiting you're done! Finish it up with:
rmdir offending_dir to get rid of the now empty offending directory and
rmdir empty to get rid of your intermediate empty directory.

HTH,
Dan
0
 
LVL 46

Expert Comment

by:Jackie Man
ID: 39834388
It is a typical disk error.

Type the procedures listed in the link below to perform a scheduled chkdsk.

http://www.computerstepbystep.com/chkdsk_windows_xp.html
0
 
LVL 81

Accepted Solution

by:
David Johnson, CD, MVP earned 500 total points
ID: 39834556
from a command prompt
rd \\.\C:\areallylongfilename /s/q  where C is the drive letter and \reallylongfilename is the top level directory that you want to remove

if there are files you may have to

del \\.\c:\areallylongfilename /s/q

note that these are \\ and not //'s

Total Commander also has support for really long filenames
0
 
LVL 10

Expert Comment

by:Scott Thomson
ID: 39887998
It looks to be the character limit on Windows

basically when your path C:\whatever\whatever\whatever reaches more than 255 on xp and 270 in windows 7? windows cannot recognise these locations and therefore cannot delete etc.

it's stupid but the best and easiest method is to go to folder 1 and rename it to the letter "a" or "1" something that is 1 character long

so where your initial folder structure was

C:\whatever\
                     whatever
                                    whatever
                                                   whatever

etc.. now you will have

C:\1
      1
        1
          1
            1
               1

this will take your folder names down massively and if you keep doing this (starting at the top folder) and continuing down to the bottom. eventually (unless you have more than 255 folders) you should be able to successfully delete your entire subdirectory
it's slow, it's paainful, but DAMMIT it works! haha

good luck
0
 

Author Comment

by:sdc248
ID: 39888946
Thank you all for your help. I tried David's solution and it worked.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question