Wanted to move files from 1 folder to other

Hi all me new to this forum as well as UiPath, getti
Wanted to move files from 1 folder to other, plz help getting error as
Argumented value : BC30311 Value type ‘String()’ canot be converted to ‘string’.The selected value is incompatible with the property

1 Like

HI @xhitija_kirtane
Because there may be multiple files in this folder, the variable type needs to be adjusted.
Please change the variable type from String to ArrayOf,and select String from T options.
Cheers

@xhitija_kirtane

directory.getfiles(“folderpath”) gives output as array of string

change your Arrfiles datatype from string to array of string

use for each activity for the Arrfiles

use move file activity inside of for each
to move file form 1 folder to another folder

cheers

Hi @xhitija_kirtane

Assign=> FolderPath= Directory.GetFiles("folder path")

Datatype is Array of String
=> Run a For each loop for above variable.
=> Inside that use Move File activity.

Source Path= currentitem.ToString
Destination Path " give the required path"

Hope it helps

ArrFiles is string variable now in your variable panel

It has to be array of string datatype instead of just string
Click on variable type drop down and choose array of string, if not click on browse for type and search for the same

This error will go then

Or

If u want to have one specific file path say first value from the directory.GetFiles array then mention the index position like this

If that’s the case then you can leave the current data type of string as it it

ArrFile = Directory.GetFiles(…….)(0).ToString

Here zero is the index of first filepath

Hope this clarifies

Cheers @xhitija_kirtane

hi unable to chase that soln so checked for this, now in
using "Move file"activity getting this error

1 Like

Checked the path & it shows the same

1 Like

You are almost done
But in your second image open copydata folder once and see whether u have that text file
That will ensure whether the file path is correct or not

@xhitija_kirtane

Hi @xhitija_kirtane ,
You can see


regards,

can any1 post step by step guide with screen shot, because the soln which youtube give, turn out to give error

Arrfiles is a string variable, not an array. Directory.GetFiles returns an array.

Also, you don’t need to assign Directory.GetFiles to another variable. Just use the Directory.GetFiles expression directly in your For Each.

ok will try this, solution