web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Can WinAPI::fileExists be used with a wildcard?

(0) ShareShare
ReportReport
Posted on by 213

Hi

Can the WinAPI::fileExists method be used with a wildcard?

For example, I would like to check a folder for an instance of a filename that starts with "12345" and would just like a boolean response if one or more files exist in that directory.  So it would return TRUE if it found "12345abc.txt" or "12345def.csv" or "12345678.txt" etc

If it can't do that, does anyone have a suggestion on how to achieve this?

Many thanks in advance

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Anton Venter Profile Picture
    20,345 Super User 2025 Season 2 on at

    No, I don't think so. Why don't you enumerate the files in the folder? You will be able to check the file name of each file. There are many examples on the internet on how to do that.

  • cjohnson300 Profile Picture
    213 on at

    In that case I would need to enumerate the files in the folder at the start (into a table or container??), and then when I loop through the files I want to check, check the container or table for those filenames.  But can I check a container like that?

  • Verified answer
    Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    You can use System.IO.Directory::GetFiles() to find files with names matching a given pattern.

  • Suggested answer
    cjohnson300 Profile Picture
    213 on at

    Thanks Martin, just what I was looking for

  • Verified answer
    cjohnson300 Profile Picture
    213 on at

    Thanks Anton

    As I wanted to check the folder contents multiple times, I used a combination of your suggestion (and stored the results in a container) and Martin's suggestion below

  • Anton Venter Profile Picture
    20,345 Super User 2025 Season 2 on at

    You are welcome.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans