Load All Files with Extension
  • 20 Jan 2023
  • 2 Minutes to read
  • Dark
    Light

Load All Files with Extension

  • Dark
    Light

Article summary

Step Details

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

Similar to the Load All Files step, the Load All Files with Extension will include all files with a specified extension from a directory and its subdirectories. The step will output the files as a list of FileData.



Properties

Similar to the Load All Files step, the Load All Files with Extension will include all files with a specified extension from a directory and its subdirectories. The step will output the files as a list of FileData.

Inputs

PropertyDescriptionData Type
DirectoryThe full path to the directory.String
ExtensionThe extension type for the files that will be loaded by the step. All files containing the extension, and are listed in the directory or sub directory will be loaded.String

Outputs

PropertyDescriptionData Type
OutputThe contents of the files loaded as a FileData type. Any file from the directory or subdirectory will be included in the output.List of FileData


Example Inputs and Outputs

DirectoryExtensionOutput
C:\ExampleszipOutputs a list of FileData that match the search criteria
C:\exampleszipOutputs a list of FileData that match the search criteria
Empty StringtxtEXCEPTION MESSAGE
Null ValuecsvEXCEPTION MESSAGE
C:\examples
Empty StringOutputs a list of FileData that match the search criteria


Common Errors

Path is empty

If the path specified for the Directory input is null or empty, the step will throw the following error. Ensure that the Directory input contains a valid string and is not null.

Exception Message:

Exception Stack Trace: DecisionsFramework.Design.Flow.ErrorRunningFlowStep: Error running step Load All Files[LoadAllFiles] in flow [Testing]: Exception invoking method LoadAllFiles on class FileSteps ---> DecisionsFramework.LoggedException: Exception invoking method LoadAllFiles on class FileSteps ---> System.ArgumentException: The path is empty. (Parameter 'path')
   at System.IO.Path.GetFullPath(String path)
   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)
   at DecisionsFramework.Design.Flow.CoreSteps.StandardSteps.FileSteps.LoadAllFilesWithExtension(String directory, String extension)
   at DecisionsFramework.Design.Flow.CoreSteps.StandardSteps.FileSteps.LoadAllFiles(String directory) 
   --- 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 ---


Could not find part of a path

If the Directory input is misspelled or incorrect, the following error will be thrown.

Exception Stack Trace: DecisionsFramework.Design.Flow.ErrorRunningFlowStep: Error running step Load All Files With Extension 1[LoadAllFilesWithExtension] in flow [Testing]: Exception invoking method LoadAllFilesWithExtension on class FileSteps ---> DecisionsFramework.LoggedException: Exception invoking method LoadAllFilesWithExtension on class FileSteps ---> System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Program Files\Decisions\Decisions Server\test'.
   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)
   at DecisionsFramework.Design.Flow.CoreSteps.StandardSteps.FileSteps.LoadAllFilesWithExtension(String directory, String extension) 
   --- 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 ---

Related Information

Example Labs:

Forum Posts:


Was this article helpful?