dir *3*.* does not work as expected

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
miskox
Posts: 553
Joined: 28 Jun 2010 03:46

dir *3*.* does not work as expected

#1 Post by miskox » 14 Jul 2018 14:29

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

npocmaka_
Posts: 512
Joined: 24 Jun 2013 17:10
Location: Bulgaria
Contact:

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

#2 Post by npocmaka_ » 14 Jul 2018 15:09

It checks also the short file names.

sst
Posts: 93
Joined: 12 Apr 2018 23:45

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

#3 Post by sst » 14 Jul 2018 16:46

Code: Select all

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

penpen
Expert
Posts: 1991
Joined: 23 Jun 2013 06:15
Location: Germany

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

#4 Post by penpen » 15 Jul 2018 05:21

You could also use findstr, so this might help:

Code: Select all

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

Post Reply