Move folders

Hi. I have a folder with multiple subfolders. I want to organize the subfolders into categories of subfolders. For example, I want to take all folders and their contents that contain “ABC” in the name and move them to the alphabet folder and all folders and their contents that contain “123” to the numbers folder.

Is there a way to do this in Studio X? I appreciate the help! Thanks!

You mean , If the File name contains “ABC” right??

Correct

@AKR - Here you go…
MoveFile_Condition.zip (120.2 KB)

If you run this as is, you will see file name with ABC will move to “AlphaBet Files” and File Name with “123” will move to folder “Numeric Files”.

Hope this helps…

2 Likes

Hi. How do I do this if the folder name contains the common thread? For example, I have folders with subcontents. The folder names contain ABC and 123. I want to sort the folders and contents out at the folder level. I want to move all folders with ABC in their name and their contents to one folder and move all folders with 123 in their name and their contents to another folder. Thanks!

Thank you!

@AKR - i didn’t get you…please provide some sample structure and explain your scenario…

Have you tried the solution I provided?

Hi. I did try that, but I’m not sure I explained my issue properly. I want to take these folders and any one that has FLEXMAP in the title, I want it and all of it’s contents moved to one folder and any folder that has CAAP in the title, I want it and all of it’s contents moved to another folder. Basically, I have a long list like this and I want to sort them. Thank you!

image

@AKR - Here you go…
MoveFile_Condition.zip (131.7 KB)

Try running the workflow as is, you will see folder name contains FLEXMAP contains files will moved to “FLEXMAP” Files and similarly for CAAP.

If you have long list, then IF statements looks ugly to design, in that case we need to go to switch statement which looks neat and clean. But since we are using “Contains” in the switch you have to add the below code as I shown below…

Check the commented out activity and click on the plus sign in the expresssion and choose advance editor…you will see this code…so you have to keep adding all the your list here and then you can place your move statement inside each case…

Hope this helps…

Thank you! Is the commented out activity available in the Studio X version?

Yes…“Switch” activity is available.

Once you are done with your testing…please mark my post solution as it helps others…

you can try using the Invoke Powershell activity with the command:

Move-Item “{folder you want to move}” “{destination location}”

Hi @AKR

please watch this video to get the solution: UiPath | Get all Files from Directory and Subfolders | Get File information | Get Size of file - YouTube

Best regards
Mahmoud