COPY MULTIPLE FILES INTO DESTINATION FOLDER

I use a for each loop to load the contents of a folder. I then use the copy file activity to copy the files to a destination folder.

I know Moving files comes to mind, but the process requires me to COPY the files.

image

I get the following error: " Destination Path xyz " is a directory, not a file.

Then i tried changing the Destination path by adding +Path.GetFileName(file) to the destination path.

image

Then i get a compilation error -
" ‘file’ is a type cannot be used as an expression"

Please advise. I just want to copy all the files in a folder to an destination folder.

Thanks in advance.

A!

when I add a ToString

image

I get

“Reference to a non-shared member requires an object reference”

as an error message.

A!

If your source file is located here:

Sourcefilepath = C:/my source/a.txt

And you want to move it to

C:/my target/a txt

Then your destination path can be derived like so:

TargetFilePath = SourceFilePath.Replace(“my source”, “my target”)

You can use the expression for TargetFilePath in your file copy or file move action.

change the variable name from ‘file’ to something else like ‘file1’ or ‘file_1’ etc.