How to fix this error (1-dimensional array of String cannot be converted to String)

studio
debug

#1

Hello,

I’m getting this error when using the .GetFiles method on an assign activity.

Assign Activity
FilesCheck = directory.GetFiles(Path_Files.ToString)

Path_Files = is a value from an excel file that is an output of a “Get Row Item” activity

The Error -
Complier Error(s) encountered processing expression “directory.GetFiles(Path_Files)”.
Value of type ‘1-dimensional array of String’ cannot be converted to ‘String’

Thanks,
Paolo


#2

Hi @pcats,

Directory.GetFiles() returns String[] data.

Therefore change the variable type of FilesCheck to String[].

Regards,
Rahamat


#3

Hi,

Please check the type of FilesCheck variable, it should be an array of string, because “directory.GetFiles” will return a 1D array of all the retrieved file names.

Thanks,
Sarthak