Copy file no erro not copying the file

Hi team,

I have to copy the file from one folder to another folder, however most of the times the file will be used by other person and i will get notification as file is read only.
When the file is readonly i am not able to copy the file. Can anyone help how to copy the file when the file is in readonly.

I am getting the file name as “~$Inputfile.xlsm” in source.
Since it is readonly the file is not copying and also it is not throwing any error. plz help.


1 Like


Then I would suggest another work around on this

Instead of copying the file copy the entire folder itself and then delete the files that you don require

Refer this video on how to copy folder

  1. Once after copying folder use a assign activity like this

arr_filepaths = Directory.GetFiles(“yourfolderpath”)

Where arr_filepaths is a variable of type array of string

  1. Then use a FOR EACH activity and pass the above array variable as input and change the type argument as string

3: inside the loop use a if condition like this

** NOT item.ToString.Contains(“your needed file name”)**

IF TRUE it goes to THEN block where use a DELETE FILE activity and pass the FileName as Item.ToString

This will delete all the files except the one you need

Cheers @nagini.pragna

is a temporary file name, which is created when the file “Inputfile.xlsm” is being accessed by another application. You may ignore files started with “~$” when you copy files.

Thanks for the reply. I need to copy that file which is starting with ~$. Is there any way.

Copy folder is giving me the error

Invoke code: Exception has been thrown by the target of an invocation.
Code I have written
Microsoft.VisualBasic.FileIO.FileSystem.CopyDirectory(Sourcedir, Destinationdir)

Can you help with this

Can you share the screenshot of that invoke activity and property panel of that as well


Can you close all the file before you copy files or the whole folder? The running error may be gone if you close all files.