Uploading Multiple Files From a Directory into the Box

Hello,

I am looking to upload multiple files into the Box account under specific folder. Once the files are uploaded into Box account under specific folder, I would like to move them to local archive directory.

I have the Box API connected and am using activity called “Box - Upload File” but it looks like you have to specific exact file, however, my file names are going to be different and won’t be consistent. Is there anyway to do this?

@nirmit.kansagra

Use for each file in folder activity whoch would get all files one after the other and inside that use upload activity and use currentfile variable to get the current file details

Cheers

Hey @nirmit.kansagra
to get all the files from the folder you can use Directory.getfiles method or you can use For Each file in folder. and to move file from one folder to another use move file activity.
here a small seq example .
files = Directory.GetFiles(“C:\Local\ToUpload”)

For Each file In files:
Box - Upload File:
FilePath = file
FolderId = “1234567890”

Move File:
    From = file
    To = "C:\Local\Archive\" + Path.GetFileName(file)

cheers

So I am for Each File in Folder activity and inside it I am using the Upload File Box activity and when I put under my variable CurrentFile under File resource in Upload File Box activity I am getting an error Compiler error(s) encountered processing expression “CurrentFile”.(2): error BC30512 option strick on disallows implicit conversions from ‘FileInfo’ to ‘IResource’. The selected value is incompatible with the property type.

Is there anyway to fix this? Would like to use Each File in Folder activity if possible. Also, is there a way to ensure that Move File activity only occurs if Upload File - Box activity/the file that is upload is successful? And also, I only want to move the file that it is uploaded under archive folder, how can I do that. Otherwise I do not want to move that file.

@nirmit.kansagra

for the first part use localresource.frompath(currentfile.Fullname)

for move file ideally if files is present upload would be successful

also why do you want to upload and move instead upload to the required folder itself

if you still want to do move after upload then you can do a get files and then if there is a returned value move else no(this is used when upload and move is not done in a go)

cheers

So what I am doing is uploading the files from our local directory to a box where our vendor has access to it. Once the file upload is successful, we want to move that file under the archive directory on our end so that if we run the process again tomorrow those same files are not getting uploaded twice. This is why I need to do upload and then move. I hope that clarifies.

I got the upload part working by using in Fileresource Localresource.frompath(currentfile.Fullname). Thank you so much.

I also got the move part working as well by using CurrentFile.ToString under the “From” in Move File activity. Can you share how to do if file was uploaded successfully then do the move? I am struggling with that part as I am not good at coding and new to UiPath.

Also, I am getting an error saying warning: Absolute paths not recommended. Use a relative path isntead that is not including a drive letter or a root folder in my “Move File” activity. How do I fix this?

Solved below error by adding the Box account under the subfolder (We had Revenue Cycle > Billing subfolder)

Errors “User does not have Connections.View permissions on the connection folder” or “Connection [*] is invalid or you do not have access to it” while running automations with Integration Service connections in Attended/Unattended mode.

I am receiving above error message, so my box account is using my user ID and password and it is connected but I am assuming the robot do not have access to it. Is there anyway to fix this?

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