Moving files from one folder to multiple folders using UIPath

**we have 100 files (any type like png, jpeg, pdfs, doc) in a folder and we need to distribute the files to multiple folders equally or distribute by percentage which we will give the percentage (like 1st folder 30% , 2nd folder 20% , 3rd folder 50%) of each folder…

Hi @Jnana_Pradeep_Dorepa - Kindly use the attached file. You have to provide your File Directory Path from where the BOT has read the number of files.

One more Configure File that you have to create as per attached screen shot and that path needs to be updated in Read Range inside the flow.

Thanks,
AK

MoveFolderConfigure

DynamicMoveFile.xaml (14.2 KB)

1 Like

Kindly show where and all you made changes and what are the values you have given.

Thanks,
AK

Thanks for sharing, which place that you are getting the mentioned error? While getting the file names from the folder or reading the config file, etc…

Thanks,
AK

Then you have debug and see. Put a Write Line activity for both “From” folder path and “Destination” folder path.

In the screen shot for Create Directory you have given “BOT Destination 1” without "" and in Move File for Destination given as “BOT Destination”

Kindly check all the path has been given properly.

Thanks,
AK

You are most welcome. If this solution works for you then kindly check the checkbox for Solution.

Regarding your query, since the percentages are not static either you have to store it somewhere or assign a variable to get the user input directly and pass that variable into the flow where the percentage has been used.

Thanks,
AK

Yes, you are absolutely correct.

Thanks,
AK

Can be done, just get the input values and store it in excel and then proceed with existing flow.

Thanks,
AK

@Jnana_Pradeep_Dorepa - It is not issue with Copy Activity, it is the with the path which is not able to find. Hence please check the path value that you are passing to Destination folder. Kindly write the values and see whether you are getting correct path.

Thanks,
AK

Hi @Jnana_Pradeep_Dorepa - Got your issue, you are trying to move the Directory. In that Directory kindly provide your file name also then only it will copy the file.

Thanks,
AK

@Jnana_Pradeep_Dorepa - First get all the file names in the loop and pass the values of the file name to the copy file activity too. It will work.

Thanks,
AK

@Jnana_Pradeep_Dorepa - Explain your requirement bit more would be helpful.

Thanks,
AK

Yeah. I got it. But tell me how do you want to develop it. Means, how you want get an input? what are all the inputs you required?

Kindly tell me about that, hence can made changes to the existing code.

Thanks,
AK

Main.xaml (22.9 KB)

  • Check this code now I am equally copying the files from one folder to multiple folders based on a given percentage

  • Change the input folder paths and destination pathsf1.zip (161.0 KB) this is the folder I have used as a source path to move the files into three folders based on a percentage like (20, 30,50)

Please check this code and let me know

@Jnana_Pradeep_Dorepa did you tried that solutiuon…?

I have changed all the paths and run . But it doesn’t giving any output or any exceptions. it running the code and simply coming back to the workflow page.
Thank you @kalyanDev

Check the logs once and check with the test data that I was given so that we can understand your requirement fulfilled or not

Thank you @kalyanDev … it’s worked successfully. But if you have time (now or later) just explain me the code inside invoke code will be helpful for me for further.

yeah…sure @Jnana_Pradeep_Dorepa and please mark it as the solution so that if anyone is looking like it may helpful for them also.

is there any possibility , that the percentage values have to ask in the middle of running the code, and we will give the percentage . Also it has to ask the number of folders are there (dest fold paths) and we will give the number like (3 or 4) . later it have to ask the equal distribution or by percentage. Then we have to give percentages if we want by percentage.
Thank you @kalyanDev