Thursday, 28 November 2019

windows 7 - How can I delete a folder with "illegal" characters?


I plugged my USB flash memory stick into a Mac and it gained some unwanted hidden folders. (See the question Prevent MacOS from making .* and ._* files for prevention.)


I'd now like to remove these from my drive but I ran into an issue. Inside the fseventsd folder is a subfolder that is not shown unless I disable "Hide protected operating system files" in folder options. I am then shown a folder icon with no name, and attempting to delete it results in no action and no error. Attempting to open it results in the error:



E:\fseventsd\ is not accessible


The filename, directory name, or volume label syntax is incorrect.



So I took a look using command prompt:


Command Prompt Hidden Folder View


I must admit, had I not known the parent folder was from Mac OSX I would have strongly suspected a virus, because the folder name renders as a smiley face in ASCII.


Apparently this is ASCII character "01":


Old ASCII chart


Any commands I issued in Command Prompt resulted in various syntax errors as well. I decided to try Powershell.


Unfortunately 1) I'm not very experienced with Powershell, and 2) it appears to have similar difficulty with the weird folder name. I got the following error in Powershell just trying to list the parent directory contents:



Get-ChildItem : Illegal characters in path.



Powershell Error


How can I delete this folder?



Answer



I was able to "fix" this by running chkdsk /f on the drive. It converted the fseventsd folder to a file which was easily deleted. However, I don't know if this "fix" was because the subfolder appeared broken to chkdsk, or if there was something else on the volume that allowed this to work.


Offering this as an answer in case it works for others.


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...