Windows Unable to Delete ._. File
Solution 1
Run the following command (could require elevated privileges / open command prompt as administrator):
del "\\?\F:\._."
For file I/O, the "
\\?\
" prefix to a path string tells the Windows APIs to disable all string parsing and to send the string that follows it straight to the file system....
Because it turns off automatic expansion of the path string, the "
\\?\
" prefix also allows the use of "..
" and ".
" in the path names, which can be useful if you are attempting to perform operations on a file with these otherwise reserved relative path specifiers as part of the fully qualified path.
Note that you cannot use the "\\?\
" prefix with a relative path.
Example:
==> set prog>"\\?\D:\bat\Unusual Names\._."
==> dir "D:\bat\Unusual Names\*"|find "._."
08.11.2015 13:25 132 ._.
==> type "D:\bat\Unusual Names\._."
The system cannot find the file specified.
==> type "\\?\D:\bat\Unusual Names\._."
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
==> del "D:\bat\Unusual Names\._."
Could Not Find D:\bat\Unusual Names\._.
==> del "\\?\D:\bat\Unusual Names\._."
==> dir "D:\bat\Unusual Names\*"|find "._."
==>
Solution 2
Even though the question has already been answered, I'd still like to offer a possible alternative solution: using the legacy "short names" (which you can display with the "/x" option to the dir command) can also allow you to get a grip on files with "funky" names that you can't handle otherwise:
C:\temp\test>dir
Volume in drive C has no label.
Volume Serial Number is 887A-5E48
Directory of C:\temp\test
11.11.2015 16:31 <DIR> .
11.11.2015 16:31 <DIR> ..
11.11.2015 16:31 7 ._.
1 File(s) 7 bytes
2 Dir(s) 44.966.129.664 bytes free
C:\temp\test>dir /x
Volume in drive C has no label.
Volume Serial Number is 887A-5E48
Directory of C:\temp\test
11.11.2015 16:31 <DIR> .
11.11.2015 16:31 <DIR> ..
11.11.2015 16:31 7 _3E35~1 ._.
1 File(s) 7 bytes
2 Dir(s) 44.966.129.664 bytes free
C:\temp\test>del _3e35~1
C:\temp\test>dir
Volume in drive C has no label.
Volume Serial Number is 887A-5E48
Directory of C:\temp\test
11.11.2015 16:31 <DIR> .
11.11.2015 16:31 <DIR> ..
0 File(s) 0 bytes
2 Dir(s) 44.966.129.664 bytes free
Solution 3
Install 7-zip, open it and use its file menu to rename the file to a normal name (for instance to aaa
) and then you can delete it. Found at this post.
I tested this on Windows XP running in a VM. I used Linux to create a file called ._.
on a shared directory.
Related videos on Youtube
Mike Koch
SOreadytohelp Currently working as a Web Developer Co-Op, writing Java web applications. When not at work or busy with schoolwork, I primarily work on Mods For Hesk, a UI overhaul and new features mod for HESK, a popular helpdesk system. You can see all of my project and contributions at http://mikekoch.me profile for Mike Koch on Stack Exchange, a network of free, community-driven Q&A sites http://stackexchange.com/users/flair/1635941.png "Age of the geek baby, stay strong." -- Alec Hardison
Updated on September 18, 2022Comments
-
Mike Koch over 1 year
I currently have a file on the root of my external hard drive simply named
._.
, which I am guessing was added to my hard drive after using it on my MacBook a while ago. I'm trying to delete this file on my Windows 10 machine; however Windows keeps claiming the file cannot be found.I also tried deleting the file through an elevated command prompt; however the same message is returned.
Is there any way I can delete this file from my hard drive through Windows?
-
Martijn over 8 years@rr- the misery you can do with unix file names tends to be much greater. :3
-
jpmc26 over 8 yearsYour command prompt shows something odd. You did
find "._."
but left out the quotes fordel ._.
. Did you trydel "._."
? -
Mike Koch over 8 years@jpmc26 yep I tried that. Came up with the same result.
-
Thomas over 8 yearsinteresting phenomenon. especially how hard it is to delete. Are you sure that the file was legitly created? (the naming of it sounds quite strange even for a mac)
-
Workman over 8 yearsMy favorite part is the file's expression of your attempts to delete it.
-
Admin over 8 years
"._."
You can't delete this because koalas are a protected species.
-
-
Scott - Слава Україні over 8 yearsThe problem appears to be that Windows cannot access the file at all, because of its non-conforming filename, so I would be very surprised if this answer works.
-
Zombo over 8 yearsIt is possible to use that prefix with a URL, al a the
start
command? -
Nelson over 8 yearsYou don't use this with a URL. You use double quotes if you want to run a URL from the start command.
-
jpmc26 over 8 years...Can this be used to bypass length limits? (E.g., delete a
node_modules
directory.) -
JosefZ over 8 years@jpmc26 As per MSDN (see link provided in my answer), yes. However, I met scenarios where
\\?\
prefix used indel
orrmdir
commands did not help. Turned to7-zip
file manager. -
MSalters over 8 years@jpmc26: It can bypass some length limits. Basically, an expanded path has a length limit of 32K. But most paths like
C:\Windows
or..
aren't expanded, and those have a length limit of only 260. That 260 limit is enforced in many places; unfortunately quite a few of those places incorrectly apply that limit also to `\\?` paths. -
sigi_tm over 3 yearsAlso works with WinRAR.