Saturday, August 29, 2015

windows 7 - delete hidden folder/file with name exceeding 256 characters


I ended up with a folder that cannot be deleted.
The issue started out as Windows 7 complained about a deletion I performed in an old recyclebin with a message 'filename too long 434 instead of 256 characters' (or something very similar).
I tried lots of things like those mentioned in this very similar question: Renaming/deleting impossible filenames in Windows 7


But I did not succeed.
I succeeded in renaming and removing lots of subfolders but not all of them.
This is what's left visibly, a folder from the recyclebin:


C:\RECYCLER\S-1-5-21-842925246-2025429265-682008880-1013\

Inside this folder is another one named com4 but that is only visible to a tool like Total-Commander. I was not able to display this folder com4 by say:


dir *.* /A:s
dir *.* /A:h

I find interesting that apparently something is in there because the following command results in: access denied. So Windows 7 recognizes an object but does not reveal or delete it.


rd "\\c:\RECYCLER\S-1-5-21-842925246-2025429265-682008880-1013\com4\

Even though I am using an elevated command prompt and logged in as admin without any limitations (I assume).


Any ideas how to get rid of this folder named com4?
Getting rid of anything below c:\RECYCLER is fine as well.


Answer



To deal with the too long of a path/filename you can shorten the names of the folders until the path/file gets short enough to delete.


Even so it looks like you have another problem. Windows can't delete some files names that get created(com4 in your case). You can try deleting these from Linux, or possibly some software other than Windows Explorer to delete it.



In addition, in Windows and DOS utilities, some words are also
reserved and cannot be used as filenames.[17] For example, DOS device
files:[19]


CON, PRN, AUX, CLOCK$, NUL COM1, COM2, COM3, COM4 LPT1, LPT2, LPT3,
LPT4 (LPT4 only in some versions of DR-DOS) LST (only in 86-DOS and
DOS 1.xx) KEYBD$, SCREEN$ (only in multitasking MS-DOS 4.0) $IDLE$
(only in Concurrent DOS 386, Multiuser DOS and DR DOS 5.0 and higher)
CONFIG$ (only in MS-DOS 7.0-8.0)



https://en.wikipedia.org/wiki/Filename


Note: I've seen some similar problems that can get fixed by using the 8.3/MSDOS versions of the filenames.



dir /X (that's a capital X.)



This command will show the the filenames in 8.3/MSDOS.


There's more information about this on the page linked to in the description:
Renaming/deleting impossible filenames in Windows 7


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...