How to read and move files inside folder

Hi team,
I have downloded a zip folder and uzipped it using BalaReva.Externals.Activities.
now I need to read the files inside the folder and move

Hi @KarthikBallary

What types of files do you have inside the folder? Excel, pdf or any other types?

1 Like

excel

reading in the sense just to move all files to a particular folder I want

Cool…

You can use the assign activity with the below code to read all the file paths available in the folder to a string array.
Directory.GetFiles(“Your Folder path”)

Now use a for each activity to loop through the array.
Inside the loop, use a move file activity. For this, give the file path which is held by the item property of the for each loop. And provide the destination folder path along with the file name.

To retrieve the file name you can use
Path.GetFileName(Item)

https://docs.microsoft.com/en-us/dotnet/api/system.io.path.getfilename?view=netframework-4.8

Hope it helps.

3 Likes

Hi @KarthikBallary,

You can use for each activity to loop all the files like below
image

can it read zipped folder?

1 Like

Yes it will move zip folder.

1 Like

Hi @KarthikBallary,
I believe there is multiple ways to do that.
First thing come in my mind is to navigate UiPath with Click tool to your folder.
Then Send Hotkeys for Ctrl+A, then Ctrl+X.
Now navigate it again with Click to place where you must move them using Send Hotkeys Ctrl+V.

Can I move a PDF file inside the folder in this same process.

Hi @adamhenry

Yeah… you can move any type of file using the same approach

2 Likes

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