Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete a folder that name ended with a dot (".")?

I got some folders created by malware whose name ended with a dot like C:\a.\ or C:\b.\, etc.

I found a solution that can remove such folder with command rd /q /s "C:\a.\" but if I call win API RemoveDirectory, it returns ERROR_FILE_NOT_FOUND.

And I just wonder how to write a function to delete such directory, thanks

I test on my own Windows XP SP3 system like this

create a folder C:\>mkdir a..\\\ and I cannot double click to access this folder. and I can remove with command rd /q /s "C:\a.\"

what Windows system API(s) that rd /q /s command call?

like image 289
jerry.liu Avatar asked Nov 02 '10 07:11

jerry.liu


People also ask

What is a dot folder?

This naming convention comes from Unix-like operating systems (such as Linux or OSX) where it means a hidden file or directory. It works anywhere, but its primary use is to hide configuration files in your home directory (i.e. ~/. cache/ or ~/. plan) They are frequently called dot files.

Can folder names have dots?

5 Answers. As far as I know there are no issues with naming folders and files with a single or multiple dots.

How do I delete a folder name?

Open My Computer or Windows Explorer. We recommend you make sure the directory or folder is empty before proceeding, unless you intend to delete everything in it. Locate the file or folder you want to delete and right-click it. Choose the Delete option from the pop-up menu.


1 Answers

Here's a solution to this problem:

rd /s "\\?\C:\Documents and Settings\User\Desktop\Annoying Folder." 
like image 161
Skilldrick Avatar answered Sep 17 '22 09:09

Skilldrick