Not able to use MoveFile Activity


I am using below edition. CE - 2019.4.3

and trying to move file from 1 local laptop location to another local laptop location and using Move File activity

From path: srcpath (without codes)
To destination: destpath (without codes)

using srcpath as source path and destpath as destination path of folders

both variables, srcpath and destpath, are of String type and have set default values as “D:\source” and “D:\destination” respectively

For Each activity - type argument has been set to string

but when I run it, it says


Details of error:

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.IO.FileNotFoundException: Could not find file ‘D:\source’.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalMove(String sourceFileName, String destFileName, Boolean checkHost)
at UiPath.Core.Activities.MoveFile.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

I have imported packages from Manage Packages as below but its not resolving…can someone help pl.

  • System.IO.FileSystem
  • System.IO
  • System.IO.FileSystem.Primitives
  • System.IO.FileSystem.AccessControl
  • System.IO.FileSystem.DriveInfo
1 Like

Hi @ashishajmani

U should mention the file name not the directory

Srcpath=Directory,getFiles(“fullpath of the file”)
Ashwin S

1 Like

Hi @AshwinS2

folder has multiple files and not 1. I cannot hard code it.


1 Like

Use below method, please note destination folder should not exist


You can create a new folder and use Move File (using foreach)


Cool @KarthikByggari

  • Used Invoke Method
  • in 2 parameter, specified folder name which does not exist and it worked.

(1). it deleted all the files from source folder and deleted the source folder. is there a way to Copy files so that both source folder and its files are intact ?
(2). I had used Move File earlier but it did not worked. I did created the destination folder before i ran the robot.

1 Like

Hi @ashishajmani

If you want to keep the files in source folder too, then instead of move file activity you have to use copy folder.

Use Invoke Code activity and enter code as shown below -


1 Like

Great @KarthikByggari…it worked seamlessly.

Many thanks.


Can you please mark the previous post as solution. Thank you :slight_smile:

1 Like

can you please guide me how to do it ? this is my first post…

do I need to check this button ?


1 Like


Yes you have to select that one.

You have to mark the @KarthikByggari solution but not yours :stuck_out_tongue_winking_eye:


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