DEL *1.* deletes all files in folder
I'm trying to delete all files that end with the number one, but for some reason it is deleting all of the files in the folder.
The command I'm using is
DEL *1.*
It works when I use a letter like
DEL *e.*
but when I use a number everything is deleted.
Windows keeps an 8.3 file name for every file to ensure compatility.
So if you have the files
test1.ext
test2.ext
test3.long
the last file gets stored with the alternative name
TEST3~1.LON
thus matching the pattern *1.*
.
You can execute dir /x
to see all 8.3 file names.
Fixes:
-
To strip all files in the directory
directory
of their 8.3 name, executefsutil 8dot3name strip directory
-
To strip all files in the directory
directory
of their 8.3 name, including those in subdirectories, executefsutil 8dot3name strip directory /s
-
To disable 8.3 file names on the drive
drive:
(only affects newly created files), executefsutil 8dot3name set drive: 1
-
To disable 8.3 file names altogether (only affects newly created files), execute
fsutil 8dot3name set 1
For the complete syntax, execute
fsutil 8dot3name strip & fsutil 8dot3name set
Furhter information:
Naming Files, Paths, and Namespaces: Short vs. Long Names
How Windows Generates 8.3 File Names from Long File Names