Copy data from folder to another folder

I am working on process in that I have to create a folder with current date i.e 6/24/20120 and copy the files from previous date (6/15/2020) folder. Can someone please help me?
Thank you!!

Can you give us the name of the folder for today’s date (for formatting purposes)?

Folder Name should be like 6-24-2020.

1.) Let MainDir be the parent directory with each day’s directories. Use a Create Folder activity with parameter String.Concat(MainDir, "\", Now.ToString("M-dd-yyyy").

2.) Create a For Each activity and iterate over System.Directory.GetFiles(String.Concat(MainDir, "\", Now.AddDays(-1).ToString("M-dd-yyyy").

3.) In the loop, let Item be the name of the file from the iterable in step 2. Use a Copy File activity, and copy Item to String.Concat(MainDir, "\", Now.ToString("M-dd-yyyy").

1 Like

Thanks Anthony! I created the same and got an error in the end as below.
Copy File Destination 1: The target file “E:\Zones Connect\6-24-2020” is a directory, not a file.

In that case, change the destination in step 3 to String.Concat(MainDir, "\", Now.ToString("M-dd-yyyy"), "\", System.IO.Path.GetFileName(Item)).

1 Like

Thanks a lot Anthony!! it worked for me.

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