Currentfile.Tostring not working

Hi, can anyone please help on this.

I am doing a double loop: for each file in folder activity inside a for each folder in folder acticity. And I am trying to use “Currentfolder.ToString” to get the file name of the current folder.

This used to work but I have been away from UiPath for a long time and it gives an error message now.

can anyone please help?

Hi,

Can you try to add () like CurrentFolder.ToString()

Regards,

1 Like

Oh, thank you!! Sorry for being dumb :frowning:

1 Like

FYI, as your project is C#, it’s necessary to add () even if there is no argument.
If VB project, it’s no problem.

1 Like

Thanks for answering! Can I ask another question real quick?

What I am trying to do is:

for each file in folders, if the file name contains “XYZ”, then proceed, if it doesn’t, then exit this loop and go back. I plan to use the built-in Filter function in the for each file in folder activity and type: CurrentFile.ToString().contains(“xyz”)

However, as shown below, it says that there is no currentfile object, which part of this went wrong?

Can you try not contains but Contains bacause C# is case sensitive?

Regards,

thanks for the reply, but its Still not working

regards,

The message shows CurrentFile doesn’t exist. Can you check it?
And also you need to add () after ToString.
And Contains method cannot have 2 arguments.

Regards,

I have corrected it and it looks like this now:
" CurrentFile.ToString().Contains(“xyz”) "

I dont understand why there isnt a CurrentFile object but there is a CurrentFolder object

As it’s filter condition, it should be as the following.

"*xyz*"

Regards,

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.