Solved

Cannot delete a folder and its sub-folders

Posted on 2014-02-04
8
508 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
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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
LVL 34

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 44

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 80

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Check network connectivity in DOS 11 118
Installing Windows XP from USB 10 116
Clone HDD in RAID1 10 142
Windows XP under Hyper-V Server 2016 15 32
If you build your web application in Visual Studio you'll get at least a few binaries, or .DLL, files in your bin folder. However, there is more compiling to be done. Normally this would happen when an ASP.NET resource within the web site is request…
Issue: Unstable cursor in Windows XP and Windows runs extremely slow in that any click will bring up the Hour glass (sometimes for several seconds before giving you what you want) . Troubleshooting Process and the FINAL FIX: This issue see…
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…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

792 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