FileListBox doesn't see the files

I have a couple of strange files on our NT server that seem to be invisible to a FileListBox, but can be found when I check for their existence using a call to FileExists(...)!  

Any reason why FileListBox would not see files that FileExist would see?

My FileListBox Code is similar to this:
FileListBox.Directory := "y:\projects\";
FileListBox.mask := "pd3001.*"
If FileListBox.Items.Count > 1 then ...';

My FileExists Code is similar to this;
If FileExists("y:\projects\pd3001.*") then ...;

When I use FileExists(), I am trying to determine if ANY file exists for a given filename.  When I use FileListBox(), I am trying to determine how MANY file exists for a given filename (ie, PD3001.TXT and PD3001.DOC).

Please help, this is causing problems with new software I've just rolled out at work!
Who is Participating?
simonetConnect With a Mentor Commented:
Thanks, WKHays. I am glad I was able to help.



wkhaysAuthor Commented:
Edited text of question.
Severel issues to this problem is unclear:

1. Could it be that the permissions to this file is too low ?
2. What is the real name of the file you are mentioning ?
3. Could it be that the file is a temporary file ?
4. Could it be that the file is a virtual file, only known to the Shell interface ?

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

wkhaysAuthor Commented:
Thanks for responding....

The file in question is really called PD30001.DWG.  It is an AutoCad drawing.

When I double-click on it in Windows Explorer, it loads up fine.  It appears to be just a normal file.  FileExists() sees it as a normal file.  

What I am trying to do is to determine whether AutoCad has created a PD30001.BAK file...   So I am checking FileListBox.Items.Count("...\PD30001.*").  This works will all other files in the directory except this file!!!!

When I set up a FileListBox with the mask set at *.*, all files show up EXCEPT this file.  I can't figure out what is special about this file.

I've never seen this before, but it is happening on two different machines.  I have checked the properties of the file and it is not hidden.
What are the file's attributes? May the file is set as Hidden or System, and, while Explorer is able to show it, TFileListBox isn't.

One possibility, even a good probability - the default filetype for TFileListBox is ftNormal.  Setting it to (ftNormal or ftArchive) will generally show all the non-special files.  Archive bits get set all the time by different programs, and then seemingly 'normal' files have an attribute bit which doesn't let them get found.
wkhaysAuthor Commented:
I went into NT Explorer and tried to turn off the various bits (hidden, Read-Only, Archive).... I'll look again, because I agree this is the likely scenario....  Let me check again and I'll get back to you.
wkhaysAuthor Commented:

In the end, the file was somehow had its SYSTEM bit set... Don't know how it got set and don't know how to clear it.

Anyway, I set my FileListBox up to read System files and I'm off to the races.

Thanks, everyone.  Simonnet - you were first with a close answer.  please answer and I'll award the points.

I thought there was an "accept comment as answer" option coming ...

All Courses

From novice to tech pro — start learning today.