yhPark
January 7, 2020, 2:23am
1
Thank you for your answer first.
I want to make an RPA with specific activities on “*.tif” files in a specific directory.
So, I used the string array and For each activity as follows:
Assign
Str_Array_Tif_file=directory.GetFiles(“Path”, “*.tif”)
ForEach ‘item’ in Str_Array_Tif_file
{Actions using Fileinfo(item)}
However, some errors occur with this RPA sometimes, because some of “tif” files has Zero size, so they cannot be opened in the RPA.
Therefore, I want to add only tif files with nonzero size to the string array in the first step. Please give me some advices.
Thanks.
lakshman
(Ganta lakshman)
January 7, 2020, 2:29am
2
@yhPark
You can check the file size inside the loop whether it’s greater than zero or not.
ForEach item in Str_Array_Tif_file
{Actions using Fileinfo(item)}
IF Item.Length > 0
Then Continue
Else skip that file.
Yoichi
(Yoichi)
January 7, 2020, 2:33am
3
Hi,
Can you try the following?
Str_Array_Tif_file=directory.GetFiles("Path", "*.tif").Where(function(x) new FileInfo(x).Length>0).toArray
Regards,
1 Like
yhPark
January 7, 2020, 2:52am
4
Thank you for your advice.
In my RPA, each tif file is classified by case and there are several different “For each activities” for each case. So, I have to insert the code into each of “For each activities” , according to your suggestion.
That’s why I want to add only tif files with nonzero size to the string array in the first step.
However, Thanks for your advice again.
1 Like
yhPark
January 7, 2020, 2:52am
5
Thank you very much. It works perfectly.
1 Like
system
(system)
Closed
January 10, 2020, 2:52am
6
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.