Home Forums UiPath extract specific files from directory using uipath

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2871
    Bhavika27Bhavika27
    Participant

    How I can extract files with specific extension let say .pdf from a directory and display there names?

    #2874
    NikitaNikita
    Participant

    In order to get files with specific extension from a path, you need to use the .Net method : directory.GetFiles(FullPath as a string,SearchPattern as a string)

    in our case:

    directory.GetFiles(FullPath as a string,“*.pdf”)

    to get the files with pdf extension.

    will first use assign activity to assign the method to an Array of strings that will hold the values of paths in the directory.

    After that step, we will use for each activity to loop on the files inside the array.

    NOTE:

    the items in the array will return the full paths of the files as string. Thus, you will need to use string manipulation to get the file name only which will be:

    item.Substring(item.LastIndexOf(“\”)+1,item.Length-item.LastIndexOf(“\”)-1).ToString

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.