Move one item from one array to another array

Hi all,
I have an issue need your kind help.
I define one array as below type:
image
After that, I get all files from one folder to this array using: Directory.GetFiles(FilePath, “.”,SearchOption.AllDirectories)

Now I want to use for each to loop the array and then move some items to another array if the condition met:
image

but it does not work, please suggest where is the problem?

thanks a lot
Michael

@Michael_zhao What kind of condition should be meet here?

if the data size of the file is more than 20MB.
thanks a lot for your reply

@Michael_zhao Here is your solution. Check the below-attached workflow

Dummy.xaml (6.7 KB)

I hope this will help you

Regards,
Vrushali

Hi @Michael_zhao

Have a look to below thread. I think might your query is somewhat similar to below thread :-

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

Hi,
thanks a lot for your solution.
I saw you move the file to one folder, but i need to append it to another array in the loop, and finally i will send it out by email with the file array .

thanks a lot, Pratik
The challenge for me is how to move the value from one array to another array in the loop.

Hi @Michael_zhao

1st of all array is a collection and is of static size so you should use List<> instead of Array for moving the items.

And also you can do many operations on List same as Array.

Below is the Workflow for moving Array Items to List :-
MainPratik.xaml (9.0 KB)

Mark as solution and like it if this helps you :slight_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

Hi Pratik,

It seems works very very fine .
I can also send it out by mail with file list after moving .
thanks a lot.
Michael

By the way, could you please let me know how to clear the list and how to check if it is empty?
assign nothing to list can clear it?
using if the list is nothing can know if it is empty, right ?

thanks very much .

You could use following expression to get just files over 1MB

FileCol = Directory.GetFiles(FilePath,".",SearchOption.AllDirectories).Where(Function(x) (New FileInfo(x)).Length > 1024000).ToArray

Cheers

Hi @Michael_zhao

Der is Clear Collection Activity to clear the List

If you want to check If List is empty or not then below is the condition for the same you can put in IF Activity :-

listOfFiles.Count=-1

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

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