# Move Folder to another Folder

**URL:** <https://forum.uipath.com/t/move-folder-to-another-folder/38014>\
**Category:** Help\
**Tags:** system, activities\
**Created:** [June 27, 2018, 11:10am UTC](https://forum.uipath.com/t/move-folder-to-another-folder/38014 "2018-06-27T11:10:16Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deeipauk](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/deeipauk/32/263296_2.png) [@Deeipauk](https://forum.uipath.com/u/Deeipauk)\
**Post date:** [June 27, 2018, 11:10am UTC](https://forum.uipath.com/t/move-folder-to-another-folder/38014/1 "2018-06-27T11:10:16Z")

</div>

Hi ,

I want to move a folder to another location.  
Eg: I have folder C:/Level1/Level2.  
I need to move this Level2 folder to C:/Level1/Target.  
‘Target’ Folder already exist with other files/folders.  
so once done I should find ‘Level2’ in C:/Level1/Target/Level2

Please Note - Its move not copy.

Please provide your suggestions

---

<div class="post-metadata">

**Author:** ![Rishabh\_Lakhera](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/rishabh_lakhera/32/21805_2.png) [@Rishabh\_Lakhera](https://forum.uipath.com/u/Rishabh_Lakhera)\
**Post date:** [June 27, 2018, 11:26am UTC](https://forum.uipath.com/t/move-folder-to-another-folder/38014/2 "2018-06-27T11:26:23Z")

</div>

Hey @Deeipauk,

Maybe these links can help you 🙂

> [@Move/Delete a directory/folder](https://forum.uipath.com/t/move-delete-a-directory-folder/28583):
>
> Hi, I am trying to move/delete a particular folder. Inside the folder, there are more folders, and inside those folders, they might be more folders, and finally in those folders are the files. are there any straightforward way to just move/delete that entire top folder?

> [@How to move a directory and its files to a new path](https://forum.uipath.com/t/how-to-move-a-directory-and-its-files-to-a-new-path/2662):
>
> I´m trying to move a direcotry with its files to another path using “copy file”, but it doesn´t work. [copy file](https://www.uipath.com/activities-guide/copy-file)

---

<div class="post-metadata">

**Author:** ![Deeipauk](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/deeipauk/32/263296_2.png) [@Deeipauk](https://forum.uipath.com/u/Deeipauk)\
**Post date:** [June 27, 2018, 11:36am UTC](https://forum.uipath.com/t/move-folder-to-another-folder/38014/3 "2018-06-27T11:36:47Z")

</div>

Thanks for your reply Rishabh.

In both the cases its given the **destination folder should not exist already** but in my case the destination already exist with other files/folders. In that destination I need to move some more folders

---

<div class="post-metadata">

**Author:** ![sarathi125](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/sarathi125/32/519448_2.png) [@sarathi125](https://forum.uipath.com/u/sarathi125)\
**Post date:** [June 27, 2018, 1:23pm UTC](https://forum.uipath.com/t/move-folder-to-another-folder/38014/4 "2018-06-27T13:23:30Z")

</div>

Hi @Deeipauk,

Try using

Directory.Move(sourceDirName, destDirName)

---

<div class="post-metadata">

**Author:** ![thediabloman](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/thediabloman/32/10422_2.png) [@thediabloman](https://forum.uipath.com/u/thediabloman)\
**Post date:** [June 27, 2018, 3:14pm UTC](https://forum.uipath.com/t/move-folder-to-another-folder/38014/5 "2018-06-27T15:14:16Z")

</div>

In that case you will need to loop through the files in the folder and copy those to the new folder.

---

<div class="post-metadata">

**Author:** ![Deeipauk](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/deeipauk/32/263296_2.png) [@Deeipauk](https://forum.uipath.com/u/Deeipauk)\
**Post date:** [June 28, 2018, 1:54am UTC](https://forum.uipath.com/t/move-folder-to-another-folder/38014/6 "2018-06-28T01:54:10Z")

</div>

where to write this code? in assignment statement? if you dont mind please provide me some sample .xaml

---

<div class="post-metadata">

**Author:** ![Deeipauk](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/deeipauk/32/263296_2.png) [@Deeipauk](https://forum.uipath.com/u/Deeipauk)\
**Post date:** [June 28, 2018, 1:55am UTC](https://forum.uipath.com/t/move-folder-to-another-folder/38014/7 "2018-06-28T01:55:49Z")

</div>

Thanks for your reply. This will complicate the process.I need to first create a new directory with the same name and move files one by one also internally it may contain sub folders also. So i feel this will complicate?

Correct me if I am wrong

---

<div class="post-metadata">

**Author:** ![Bharat](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/bharat/32/56552_2.png) [@Bharat](https://forum.uipath.com/u/Bharat)\
**Post date:** [June 28, 2018, 4:40am UTC](https://forum.uipath.com/t/move-folder-to-another-folder/38014/8 "2018-06-28T04:40:06Z")

</div>

As @sarathi125 suggested, Directory.Move method moves a directory and all its contents, including nested subdirectories and their files, to a new location and if the destination directory already exists, an error occurs.  
You cannot use assign activity because return type of this method is none.  
You can write this code in invoke method activity with the following options:

1. Target Type as System.IO.Directory
2. Method Name as Move
3. Two parameters in property panel with In and String Type for SourceDirectory and DestinationDirectory.

![DirectoryMove](https://global.discourse-cdn.com/uipath/original/3X/4/c/4c94f2fd57d2e666e55c9e0689207c739c6f1dd5.JPG)

---

<div class="post-metadata">

**Author:** ![Deeipauk](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/deeipauk/32/263296_2.png) [@Deeipauk](https://forum.uipath.com/u/Deeipauk)\
**Post date:** [June 28, 2018, 7:22am UTC](https://forum.uipath.com/t/move-folder-to-another-folder/38014/9 "2018-06-28T07:22:58Z")

</div>

Thanks for your reply

“Invoke Code” – is this the activity I need to use?  
When i look at screen shot shot this looks like “Invoke Method” which will throw error since the destination diretiry already exist.

If you don’t mind please provide a sample .xaml

---

<div class="post-metadata">

**Author:** ![CamiCat](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/camicat/32/176794_2.png) [@CamiCat](https://forum.uipath.com/u/CamiCat)\
**Post date:** [July 12, 2018, 3:01pm UTC](https://forum.uipath.com/t/move-folder-to-another-folder/38014/10 "2018-07-12T15:01:47Z")

</div>

> [@sarathi125](#):
>
> Directory.Move(sourceDirName, destDirName)

Hello @sarathi125.  
How can this be done?  
Thank you so much,  
Camilla

---

<div class="post-metadata">

**Author:** ![Nandhini\_Thirumaran](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/nandhini_thirumaran/32/62785_2.png) [@Nandhini\_Thirumaran](https://forum.uipath.com/u/Nandhini_Thirumaran)\
**Post date:** [May 20, 2019, 12:47pm UTC](https://forum.uipath.com/t/move-folder-to-another-folder/38014/12 "2019-05-20T12:47:58Z")

</div>

hi Bharat,

i get an error as Source & destination path must have identical roots. Move will not work across volumes.

---

<div class="post-metadata">

**Author:** ![Deeipauk](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/deeipauk/32/263296_2.png) [@Deeipauk](https://forum.uipath.com/u/Deeipauk)\
**Post date:** [May 21, 2019, 1:35am UTC](https://forum.uipath.com/t/move-folder-to-another-folder/38014/13 "2019-05-21T01:35:10Z")

</div>

Could you please share some details about exactly what u r trying to do and the error u r facing,

---

<div class="post-metadata">

**Author:** ![Nandhini\_Thirumaran](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/nandhini_thirumaran/32/62785_2.png) [@Nandhini\_Thirumaran](https://forum.uipath.com/u/Nandhini_Thirumaran)\
**Post date:** [May 21, 2019, 3:59am UTC](https://forum.uipath.com/t/move-folder-to-another-folder/38014/14 "2019-05-21T03:59:46Z")

</div>

i get an error as Source & destination path must have identical roots. Move will not work across volumes.

---

<div class="post-metadata">

**Author:** ![Nandhini\_Thirumaran](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/nandhini_thirumaran/32/62785_2.png) [@Nandhini\_Thirumaran](https://forum.uipath.com/u/Nandhini_Thirumaran)\
**Post date:** [May 21, 2019, 4:20am UTC](https://forum.uipath.com/t/move-folder-to-another-folder/38014/15 "2019-05-21T04:20:15Z")

</div>

Am trying to move files in a folder located in share drive to local drive . It is copying the entire folder. unable to do it using move

---

<div class="post-metadata">

**Author:** ![Deeipauk](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/deeipauk/32/263296_2.png) [@Deeipauk](https://forum.uipath.com/u/Deeipauk)\
**Post date:** [May 21, 2019, 4:52am UTC](https://forum.uipath.com/t/move-folder-to-another-folder/38014/16 "2019-05-21T04:52:42Z")

</div>

Please check the XAML attached.  
In Simple, we can’t move the folder. So I copied the source folder to destination and deleted the source. It works fine. Please check and confirm[sample.xaml](https://global.discourse-cdn.com/uipath/original/3X/2/7/27639718874f26dfa0a52388e6ba13aae8302e83.xaml) (5.1 KB)

---

<div class="post-metadata">

**Author:** ![Tiberiu\_Niculescu](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/tiberiu_niculescu/32/177057_2.png) [@Tiberiu\_Niculescu](https://forum.uipath.com/u/Tiberiu_Niculescu)\
**Post date:** [May 21, 2019, 5:49am UTC](https://forum.uipath.com/t/move-folder-to-another-folder/38014/17 "2019-05-21T05:49:39Z")

</div>

[MoveDirectory.xaml](https://global.discourse-cdn.com/uipath/original/3X/2/8/2818646378f96f3041459bbfcb88ecd7b52783bc.xaml) (10.7 KB)

This will copy a directory and all its subsequent subdirectories and files to your chosen location. Just invoke this somewhere to copy the files and then delete the original folder. Or if you want to, you can replace the ‘Copy file’ activity with a ‘Move’ activity.

---

<div class="post-metadata">

**Author:** ![suryaprakashm](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/suryaprakashm/32/111892_2.png) [@suryaprakashm](https://forum.uipath.com/u/suryaprakashm)\
**Post date:** [November 18, 2019, 7:19am UTC](https://forum.uipath.com/t/move-folder-to-another-folder/38014/18 "2019-11-18T07:19:47Z")

</div>

While moving the files from one folder to another folder, In this case the main folder files only moved to another folder not sub folder files - Please help me regarding this.  
Example : C://Main folder files : Test\_001, Test\_002  
Sub folder : C://Main folder files//Sub folder files : Test\_001,Test\_002

---

<div class="post-metadata">

**Author:** ![Palaniyappan](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/palaniyappan/32/524095_2.png) [@Palaniyappan](https://forum.uipath.com/u/Palaniyappan)\
**Post date:** [November 18, 2019, 7:23am UTC](https://forum.uipath.com/t/move-folder-to-another-folder/38014/19 "2019-11-18T07:23:26Z")

</div>

Hi  
Welcome to uipath community  
Yes buddy  
Were you facing any issue in that  
Cheers @suryaprakashm

---

<div class="post-metadata">

**Author:** ![suryaprakashm](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/suryaprakashm/32/111892_2.png) [@suryaprakashm](https://forum.uipath.com/u/suryaprakashm)\
**Post date:** [November 18, 2019, 7:40am UTC](https://forum.uipath.com/t/move-folder-to-another-folder/38014/20 "2019-11-18T07:40:52Z")

</div>

Hi @Palaniyappan  
Many files are in the same names, i need to move main folder files - So i search some file names and move the files from one folder to another folder, While moving the files all files moved, how to split the main folder files.  
Thanks

---

<div class="post-metadata">

**Author:** ![Soumya587](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/soumya587/32/62916_2.png) [@Soumya587](https://forum.uipath.com/u/Soumya587)\
**Post date:** [February 12, 2020, 10:55am UTC](https://forum.uipath.com/t/move-folder-to-another-folder/38014/21 "2020-02-12T10:55:03Z")

</div>

Hey ,I need to move folder with files to destination folder that does not exist but the challenge is i have to move into destination subfolder that does not exists.but when I try passing it in parameters in invoke method I get error saying that cannot find part of the file

[Next page](https://forum.uipath.com/t/move-folder-to-another-folder/38014.md?page=2)
