DABhand posted on Oct 14, 2014 7:49:39 PM - Report post
People have asked me a few times, including recently in a PM here about files that are unable to be deleted either because they seem to not exist or are system protected.
The simple method is to check if you can use the attrib command.
Say you have a file located in C:\files\damnfile.exe and yet you cannot see it, but you know it is there
You can open up a command prompt and type the following
attrib -r -a -s -h c:\files\damnfile.exe
And hopefully you can easily delete it.
Now for those System Protected files that cannot be deleted even as Administrator because the TrustedInstaller service owns it..
Find out the location of the file, will use the above example again..
firstly in the command prompt type the following
takeown /f c:\files\damnfile.exe
This will give you ownership of the file, but it has yet to set the rights for you to delete it from the system, to do that type the following in command prompt..
cacls c:\files\damnfile.exe /G username:F
(/G and F have to be in caps)
Change username to your windows username, and this will give you the full rights to the file, and from there able to delete the file.
This will work with those Adobe files that are left behind and cannot be deleted.
Oh and Don't forget some tuts on ASM and defeating DMA
Wrythe1985 posted on Oct 14, 2014 8:40:09 PM - Report post
How do you delete files that have a directory path name greater than 32,000 characters? Note: Remove-Item, del, and rmdir /S /Q do NOT work even from an elevated cmd (even though the only user account on the machine is an admin account). I reaaaallly am trying to avoid using third-party applications but at this point my boss won't care as long as I can delete the stuff.
I don't know if this sheds any light on the issue either...The directory path is basically a ton of Appdata directories within Appdata directories. The two or three files I actually needed were restored from a backup off of our system share..the backup program is Areca Backup if that makes a difference.
PHAT CAT
DABhand posted on Oct 14, 2014 9:22:19 PM - Report post
Large folders you should be able to delete via a file browser, unless it contains a file that is owned by the TrustedInstaller service, which then you have to get rid of first.
Or simply right click the folder and rename :P
As long as there is no process running from a file in the folder. If so you will have to kill that process and then delete the folder, or do it in Safe mode.
Oh and Don't forget some tuts on ASM and defeating DMA
Wrythe1985 posted on Oct 15, 2014 4:54:38 PM - Report post
I really just want to delete the whole directory. The file I needed has been moved to the real Appdata folder...I basically need to delete the "restored" Appdata "containers". The problem has nothing to do with owners...when the stuff is moved from a user's workstation to the backups share repository, whoever pulls a copy off the share becomes the new "owner".
But, as I said, the file isn't the issue, I want to get rid of the entire directory but Windows can't delete it because the "directory path is too long". I fail to understand why Windows lets it be created in the first place if it's going to be too long, but hey, it's Microsoft.
PHAT CAT
DABhand posted on Oct 16, 2014 1:07:21 AM - Report post
Like I was saying, just rename the folder, as long as no process is running from that folder. Also if shared on a network, just stop it from being shared also. Then you should have control over the folder.
Or just rename it in safe mode, and then delete it.
Oh and Don't forget some tuts on ASM and defeating DMA
Wrythe1985 posted on Oct 16, 2014 4:51:37 PM - Report post
Either I'm missing something in trying to explain or my explanation is not understood. Here are some links to issues that are exactly like mine except the suggested fixes for the linked issues don't work for me...
Again, I reeeeeaaaalllllllyyy do NOT want to have to resort to downloading a third-party application BUT if someone can link one that is malware-free and will easily be removed after use I would be extremely grateful.
PHAT CAT
DABhand posted on Oct 17, 2014 12:28:19 AM - Report post
I know your situation.
You have a repeated amount of the same folder from the parent folder.
Like I said before it is best to do this in safe mode to eliminate the possibility that a file is being used or is running a process, it may not be doing it, but thats just to make sure.
And then you will have to navigate your way.
But sometimes just renaming the parent folder to something else, makes the situation easily dealt with.
Or you will have to manually go through each and every sub folder till you reach the last one and manually delete and go back and delete etc.
You can also get some old Windows XP boot disks, that have the OS bootable from CD, this will make it easier to simply delete the folders since it has no protection from it's own OS it is installed with.
There is good freeware apps like Total Commander or even 7zip.
While in 7zip's window, navigate to the first folder and Shift+Del the folder and it should remove them all.
Total Commander can do the same thing also.
Unfortunately you may have to resort to installing a 3rd party app, because windows as you know has limits and that is the reason you are getting that error.
Oh and Don't forget some tuts on ASM and defeating DMA
DABhand posted on Oct 17, 2014 12:38:46 AM - Report post
This batch file should work, just rename it to something simple and put it in the parent directory if you can.
@echo off if not (%1)==() cd %1 for /D %%i in (*) do if not %%i==_ ren "%%i" _ pushd _ %0 popd
I will assume you know how to use batch file switches.
EDIT: Forgot to say what it does :P It will take you to the last folder from that parent folder. And then it is a simple use of either renaming each folder to a 1 letter character or deleting it. Until you get to the point of being under the Max_Path allowance.
Also even simply robocopy will work too.
Just make a rubbish folder in the parent directory of the folders giving problems, and then use