Page 1 of 1

dir *3*.* does not work as expected

Posted: 14 Jul 2018 14:29
by miskox
Hello all!

Put this .cmd in an empty folder:

Code: Select all

@echo off
break>FreeYD_2.1.2.exe
break>Pro_V2.1.9.exe
break>Pro_V3.exe
break>Pro_V3_1_5.exe
break>Pro_V3_2_8.exe

dir *3*.*

del *.exe
echo exe files deleted

dir

break>GIHO_TubeGet_FreeYD_1.2.7.exe
break>GIHO_TubeGet_FreeYD_2.1.2.exe
break>GIHO_TubeGet_Pro_V2.0.7.exe
break>GIHO_TubeGet_Pro_V2.1.4.exe
break>GIHO_TubeGet_Pro_V2.1.9.exe
break>GIHO_TubeGet_Pro_V3_1_5.exe
break>GIHO_TubeGet_Pro_V3_2_8.exe

dir *3*.*
Run it. It should display:

Code: Select all

c:\>a.cmd
14.07.2018  22:26                 0 Pro_V3.exe
14.07.2018  22:26                 0 Pro_V3_1_5.exe
14.07.2018  22:26                 0 Pro_V3_2_8.exe
               3 File(s)              0 bytes

exe files deleted

14.07.2018  22:26               442 a.cmd
               1 File(s)            442 bytes

 Directory of c:\

14.07.2018  22:26                 0 GIHO_TubeGet_Pro_V2.1.9.exe
14.07.2018  22:26                 0 GIHO_TubeGet_Pro_V3_1_5.exe
14.07.2018  22:26                 0 GIHO_TubeGet_Pro_V3_2_8.exe
14.07.2018  22:26                 0 GIHO_TubeGet_Pro_V2.0.7.exe
               4 File(s)              0 bytes
c:\>
At first only files with 3 in a filename are listed. Second dir shows files without 3 in the filename (GIHO_TubeGet_Pro_V2.1.9.exe for example).

(XP Pro, sp3)

Ideas?

Thanks.
Saso

Re: dir *3*.* does not work as expected

Posted: 14 Jul 2018 15:09
by npocmaka_
It checks also the short file names.

Re: dir *3*.* does not work as expected

Posted: 14 Jul 2018 16:46
by sst

Code: Select all

dir ????????*3*.*
Bypasses short file names but also file names with original length of less than 9

Re: dir *3*.* does not work as expected

Posted: 15 Jul 2018 05:21
by penpen
You could also use findstr, so this might help:

Code: Select all

dir /b * | findstr "3.*\."
penpen