Note that there are some explanatory texts on larger screens.

plurals
  1. PODirectory.GetFiles - different output dependent on OS
    primarykey
    data
    text
    <p>I have a simple program. It runs .NET 4.5 and is built in Visual Studio 2013.</p> <p><code>D:\\MyDir</code> is full of <code>.xlsx</code> files and no <code>.xls</code> files. When I run the program on Windows 8.1 x64, the filter for <code>*.xls</code> returns no results. When I run the same program, with the same .NET version on Windows 7 x86, the <code>*.xls</code> filter returns the same results as the <code>*.xlsx</code> filter.</p> <p>The test folders on both systems definitely contain the same data.</p> <p>Am I missing something, or is this a bug in .NET and/or Windows?</p> <p>The respective code:</p> <pre><code>using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace throw_test { static class Program { static void Main() { int fileCount1 = Directory.GetFiles("D:\\MyDir", "*.xlsx").Length; int fileCount2 = Directory.GetFiles("D:\\MyDir", "*.xls").Length; Console.WriteLine("File Count 1: " + fileCount1); Console.WriteLine("File Count 2: " + fileCount2); Console.Read(); } } } </code></pre> <p><strong>Edit 1</strong></p> <p>When I navigate to the directory using the command prompt in Windows 8.1 x64:</p> <ul> <li><code>dir *.xlsx</code> returns all files as expected</li> <li><code>dir *.xls</code> returns 'File Not Found'</li> </ul> <p>Windows 7 returns the expected files on both of the above commands.</p> <p>My guess is that .NET uses this command under the hood, thus the above results?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload