Extract files

how to get files from different folder which is placed in 1 main folder?
TIA

Hi @Cuberoot

you can use this to get all the files which are present in any subfolder level inside a main parent folder. Just give the folder path in place of MainFolderPath.

Directory.GetDirectories(MainFolderPath,“.”,SearchOption.AllDirectories)

Happy Automation! :smiley:

@Cuberoot

  1. Drag and drop the “Assign” activity to your workflow.
  2. In the properties panel of the “Assign” activity, create a new variable called mainFolderPath of type String and assign the path to your main folder.
  3. Add another “Assign” activity below the first one.
  4. In the properties panel of the second “Assign” activity, create a new variable called filesArray of type Array of String.
  5. Set the value of filesArray using the following expression:

vbCopy code

Directory.GetFiles(mainFolderPath, "*", SearchOption.AllDirectories)

This expression uses the Directory.GetFiles method to retrieve an array of file paths. The method takes the mainFolderPath variable as the base directory, “*” as the search pattern (which matches all files), and SearchOption.AllDirectories to include files from all subdirectories.