Opening a file using a wildcard

  • 6 March 2020
  • 1 reply

Hey everyone,


I am needing my bot to be able to open a daily file with every file having this type of naming convention: "Filename.YearZeroMonthZeroDay.RandomNumbers" so something like this: ExampleFileName.20200306.8975421


However, because of the random numbers at the end the bot cannot open that daily file. I have variablized the filename like this: Name.[*YEAR][*MONTH_ZERO-FILLED][*DAY_ZERO-FILLED]. I have tried wildcarding the end with * but the File Exist function does not work with wildcards. Is there a way to bypass this or maybe another method i should try? Thanks


Best answer by Aaron_Bultman 6 March 2020, 19:41

View original

1 reply

Hi fshah,

One way to deal with this situation would be to use a Create List Action to create a list of all files in the target folder.  When creating the Action, be sure to select File & Folder List in the Type field.  Once this Action is executed, you will see the List added to your botflow.  You can then use a Loop Action to go thru each file in the list.  When adding the Loop Action, be sure to select List from the Loop field ... then select the list that was just created.  Now that the loop has been created, add any Action (such as an Open File Action) inside the loop and you will have access to special loop tokens that are only available when inside a loop.  You can use the [*CURRENT_ITEM_FULL_PATH] token to get the full path to the file (Ex: "C:MyFolderExampleFileName.20200306.8975421").  There are also other helpful tokens available in the Loop view of the Expression Builder.  A few are [*CURRENT_ITEM_FILE_NAME_ONLY] and [*CURRENT_ITEM_FILE_EXT].