How do I move an entire folder with its contents?

Hi there!

So, I thought I was being clever by using the “Move File” activity to move directory folders from one path to another; however, I noticed that the folder didn’t move–only the subfolders and its contents. The process I created is shown below:



The Operations team runs a program every morning that generates new files that get worked that day. Unfortunately, there are many days that they forget to move the daily folders into the correct folder path after processing. So, I am trying to build a process that checks for the last 7 days worth of folders. If the bot finds the folder, it will move the entire folder and its contents to the correct month-year folder–for example, yesterday’s folder 20230116 would be moved into the path 2023 > 1. When I ran the above process, I noticed that it took copies of the files for multiple days and places them into the subfolders. It doesn’t move the actual daily folder. How can I have the entire folder and its contents moved to the new location? Thanks in advance!

Brandon

I decided to go with the following logic:

Zipping the folder before moving it worked perfectly. It would be nice to have some extra parameters on the Move File activity that allowed us to check a box to move the folder and all of its contents. Thank you!

1 Like

Hi Brandon,

Glad to hear you were able to find a solution. Another way to get this to work would be to move each file in the folder individually but it a loop. You would use the “List directory files” activity to get an array of the files in a folder. Then using a “Do-while loop” activity, go through each file and move it to the new folder.

We’ll also take your suggestion in for consideration as an enhancement in a future release.

Regards,
Arran

1 Like

Yes, I almost went with that option, but I didn’t want that many steps to move a folder and its contents. Thank you for bringing that up though! :slight_smile:

1 Like