List Files in Directory By Extension
  • 10 Jan 2023
  • 1 Minute to read
  • Dark
    Light

List Files in Directory By Extension

  • Dark
    Light

Article summary

Step Details

Introduced in Version4.0.0
Last Modified in Version7.12.0
LocationFile Management

The List Files in Directory By File Extension will list all files in a directory or subdirectory. However, the step will list only files with a specific file extension.



Properties

Inputs

PropertyDescriptionData Type
Directory NameThe name of the directory including its full path.String
ExtThe file extension used for filtering.String

Outputs

PropertyDescriptionData Type
OutputOutputs a list of all files found within the directory and its subdirectoriesList of Strings


Common Errors

Unable to locate Directory. Directory does not exist

By default, Decisions will search for the directory starting from C:\Program FIles\Decisions directory. To ensure the directory can be located, include the full file path to the directory for the Directory Name input.

Exception Message:

Exception Stack Trace: DecisionsFramework.Design.Flow.ErrorRunningFlowStep: Error running step List Files In Directory By Extension 1[ListFilesInDirectoryByExtension] in flow [Testing Flow]: Exception invoking method ListFilesInDirectoryByExtension on class FileSteps ---> DecisionsFramework.LoggedException: Exception invoking method ListFilesInDirectoryByExtension on class FileSteps ---> System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Program Files\Decisions\examples'.
   at System.IO.Enumeration.FileSystemEnumerator`1.CreateDirectoryHandle(String path, Boolean ignoreNotFound)
   at System.IO.Enumeration.FileSystemEnumerator`1.Init()
   at System.IO.Enumeration.FileSystemEnumerableFactory.UserFiles(String directory, String expression, EnumerationOptions options)
   at System.IO.Directory.InternalEnumeratePaths(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options)
   at System.IO.Directory.GetFiles(String path, String searchPattern, EnumerationOptions enumerationOptions)
   at System.IO.Directory.GetFiles(String path, String searchPattern, SearchOption searchOption)
   at DecisionsFramework.Design.Flow.CoreSteps.StandardSteps.FileSteps.ListFilesInDirectoryByExtension(String directoryName, String ext) 
   --- End of inner exception stack trace ---
   at DecisionsFramework.Design.Flow.StepImplementations.InvokeMethodStep.Run(StepStartData data)
   at DecisionsFramework.Design.Flow.FlowStep.RunStepInternal(String flowTrackingID, String stepTrackingID, KeyValuePairDataStructure[] stepRunDataValues, AbstractFlowTrackingData trackingData)
   at DecisionsFramework.Design.Flow.FlowStep.Start(String flowTrackingID, String stepTrackingID, FlowStateData data, AbstractFlowTrackingData trackingData, RunningStepData currentStepData) 
   --- End of inner exception stack trace ---



Was this article helpful?