Is there as way I can move all files(I have 1000 .pdf files to move each time) from folder to folder in one go? I know how to do that using the for each loop, but that’s taking a very long time(30 minutes to move 600 files) to move all files. I will have around 1000 files to move each time. So, trying to find a better solution to improve performance.
@prasath17 - Thank you for sending that code. But I don’t see any performance difference. My files are being moved from a shared rive folder to shared drive folder. Not sure if that takes more time. Local folder to folder is working great with this code, it’s taking from coupe of seconds to few seconds to move in local. Thank you very much
Another advantage of using PowerShell is that you can use the same approach on mapped network drives as well. Unlike using move from UiPath, which can only do this from 2021.09, if I remember correctly.
Then I am assuming the two shared drives are in different subnets and the communication lag leads to slower execution from PowerShell. Nonetheless, you learnt two new ways of solving your problem and now know that PowerShell can be a fallback. UiPath is great, but PowerShell is more flexible when you cant find a better way in UiPath studio
Also I think running this in batches is better suited to your case. You can try it yourself, when you copy large number of files, windows file movement has a lot of lag. But if you choose less number of files each time, the move / copy is faster.
If you use batches, you can use all three (for-loop in Studio, array.ForEach, or PowerShell) and will see minimal performance lags between all of them and overall job of moving.
To do this, you need to ensure you have a bin. Say each batch takes 50 from the array where filepath is found. The next batch skips first 50 and takes next 50 and moves them. Repeat this until the end of the array length.
Worth trying if this is a high frequency process, say executed every day by the robot.
When you find a suitable solution, do share it here, we are interested in knowing what solves such a problem!
Ignore my previous post in this thread. The below is wrong.
I talked to a network drive expert and was told that the fastest way to move files in network drive is moving one big file versus multiple small files. This is because the IO in network drives perform well when the incoming packets are in one chunk and will perform slowly if we do mutiple moves for each file.
So I have edited my suggested solution to zip .pdf files,