vendredi 4 septembre 2020

Directory.GetFiles search pattern returning invalid results

I have a folder containing thousands of ZIP files. Each file begins with a number which i can use to identify the files i want.

I am using the Directory.GetFiles method to filter the directory but im getting strange results.

var Files = Directory.GetFiles(path, "104*");

I am getting some files back that begin with 108 and 106. The majority of the files are starting with 104.

The same problem exists in windows when using the DIR command to filter the contents of the directory.

DIR 104*

C:\Files>dir 104*.zip
 Volume in drive C is Windows
 Volume Serial Number is 0678-3056

 Directory of C:\Files

01/09/2020  04:01           100,386 108_EXP_20200831_V0100.zip
13/08/2020  04:01            91,249 106_EXP_20200812_V0100.zip
11/08/2020  04:01            10,800 104_EXP_20200810_V0100.zip
12/08/2020  04:01            19,417 104_EXP_20200811_V0100.zip
13/08/2020  04:01            16,214 104_EXP_20200812_V0100.zip
18/08/2020  04:01            93,054 104_EXP_20200817_V0100.zip
19/08/2020  04:01            99,334 104_EXP_20200818_V0100.zip
20/08/2020  04:01            95,682 104_EXP_20200819_V0100.zip
25/08/2020  04:01            97,149 104_EXP_20200824_V0100.zip
26/08/2020  04:01           101,895 104_EXP_20200825_V0100.zip
27/08/2020  04:01           108,204 104_EXP_20200826_V0100.zip
01/09/2020  04:01           113,019 104_EXP_20200831_V0100.zip
              12 File(s)        946,403 bytes
               0 Dir(s)  15,618,355,200 bytes free

Aucun commentaire:

Enregistrer un commentaire