I guess you're using "rd /s" after using takeown and icacls commands, to
take ownership and grant yourself permissions recursively to all
subdirectories and files in the tree?:
C:\>takeown /F C:\MyDirectory /R /D y
C:\>icalcs C:\MyDirectory /grant:r John:F
I'll assume you've done this and you're still seeing problems.
Normal Win32 commands cannot delete a file or directory whose pathname is
more than 260 characters long. If your large directory has many long
pathnames, that may be the problem (see for example,
http://support.microsoft.com/kb/320081). The best workaround I have found
for this is to use the "rmdir" command in the Services for Unix subsystem.
POSIX commands are not subject to the Win32 MAX_PATH limitation. But not
everyone has the Unix subsystem installed (if not, why not?
. The next
alternative is to shorten the path names, begining from the top, so that
the path gets to less than 260 chars. So, if you have a path like this:
C:\Directory1\Subdirectory2\subdirectory3\subdirectory4\subdirectory5\...
etc
start by renaing "Directory1" to a single character, such as "1". Then try
"rd /s c:\1" again. If it still complains, renames Subsdirectory2 to a
single char, such as "2". And so on. Eventually, the longest path in the
tree will get back down under 260 chars in length, and the whole tree can
be deleted.
This will only work if the obstacle is the length of the pathnames. If you
are being prevented from deleteing files because they are in use, or you
do not have permissions etc, you will need to use other steps to correct
the problem.