Microsoft KB Archive/327151

= FindFile/FindNextFile Query or DIR Query Does Not Return the Correct Set of Files =

PSS ID Number: 327151

Article Last Modified on 12/3/2003

-

The information in this article applies to:


 * Microsoft Windows 2000 Advanced Server SP1
 * Microsoft Windows 2000 Advanced Server SP2
 * Microsoft Windows 2000 Advanced Server SP3
 * Microsoft Windows 2000 Professional SP1
 * Microsoft Windows 2000 Professional SP2
 * Microsoft Windows 2000 Professional SP3
 * Microsoft Windows 2000 Server SP1
 * Microsoft Windows 2000 Server SP2
 * Microsoft Windows 2000 Server SP3

-



This article was previously published under Q327151



SYMPTOMS
If you create a set of files that have long file names, and then you use FindFile/FindNextFile or the dir command to run a query, the query does not return the correct set of files.



CAUSE
If you turn on automatic short file name generation for the files, every file has a short name and a long name. The short name algorithm may generate very similar short file names for two different files. For example:

dir /x 142183*.*

01/04/2002 11:48 AM 623,826 142183~2.PRT 14218301000.prt

01/11/2002 07:14 AM 72,752 142183~1.PRT 14012516000.prt

If you use FindFile/FindNextFile or the dir command to run a query on a set of files, the file system searches for all file names and short file names that match the particular expressions (for example, 142183*.*). Because files may share the same short file name, the results of the query may contain file names that are not consistent with the query.



WORKAROUND
To resolve this problem, turn off automatic short file name generation (8.3 name creation) on the NTFS file system partitions on the computer.

NOTE: When you turn off automatic short file name generation, it only applies to any new files that are created on the computer. It does not remove the short file names for the files that already exist on the computer. To receive the correct results from a query, copy the existing files to a new folder, and then run the query.

For additional information about how to turn off automatic short file name generation, click the article number below to view the article in the Microsoft Knowledge Base:

210638 How to Disable Automatic Short File Name Generation

121007 How to Disable the 8.3 Name Creation on NTFS Partitions

IMPORTANT: If you turn off automatic short file name generation, it may cause difficulties for programs that rely on short file names.



STATUS
This behavior is by design.

Keywords: kbfix kbprb KB327151

Technology: kbwin2000AdvServ kbwin2000AdvServSearch kbWin2000AdvServSP1 kbWin2000AdvServSP2 kbWin2000AdvServSP3 kbwin2000Pro kbwin2000ProSearch kbWin2000ProSP1 kbWin2000ProSP2 kbWin2000ProSP3 kbwin2000Search kbwin2000Serv kbwin2000ServSearch kbwin2000ServSP1 kbwin2000ServSP2 kbwin2000ServSP3 kbWinAdvServSearch

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© 2004 Microsoft Corporation. All rights reserved.