How to print all PDFs in the same folder

Hi all,

I’m wondering if UiPath can print all the PDFs in the same folder at the same time? Though I have seen some topics in the community, I am confused about, what data type should this be? Directory.GetFiles(“filepath”, “*.pdf”), and what are the “ filename”?
Or else, do you have any other solutions?

Thank you

Hi @Paddi

When you try to access Directory.GetFiles(“filepath”, “*.pdf”), the output will be of a type array of string & you can use it like this:

fileNamesArray = Directory.GetFiles(“filepath”, “*.pdf”)

Here, fileNamesArray is of data type System.String[] (Array of String).

You can iterate through the array elements to access each file name.

Hope this helps,
Best Regards.

hihi @arjunshenoy Thanks for your answer, and do you know how to print every single file in this array?

Do you know how can I find my server name, share name and file name in Studio? Thank you.

In UiPath, we used ‘Invoke power shell’ activity and the command used is “print /d:<ServerName> filename”

@Paddi

You can print the values or loop through values using for each loop

  1. In for each loop in argument give the Directory.GetFiles("Folderpath", "*.pdf") (or you can give the array of string variable if assigned to variable)
  2. Change type argument to string
  3. Use a log message and give currentitem which would give you the filepath

Now yo extract what you need you can get filepath usign …Path.GetFileName(currentitem)

image

Remaining values we need to see how that path is and may be extract it

Hope this helps

cheers