While copying a file from one path to another path, if any of the folders/sub folders doesn’t exists while copying, is there a way to auto create them while copying?
For Eg: If I am trying to copy this file from C:\Users\RPA\Reports\test1234.txt
to
D:\Users\RPA\OutputFiles\Reports\text1234.txt where “OutputFiles” and “Reports” folders doesn’t not exists. Is there an easy way to create these missing folders automatically, if they do not exists?
@Krithi1 - If I am not wrong…I don’t think Copy File will create a missing folders…
You have to check upfront using System.IO.Directory.Exists(Path) or “Path Exists” (and choose Folder) activity for each subfolders, if it returns false then create a folder and then proceed to copying…
I could think of same thing, but I wanted to check if there an easy and automatic way of doing it, since there are a number of files I need to copy this way. It would be a tedious process to create all those folders if I have to create them using create folder activity.
In addition to what @prasath17 said, there is another way you can explore the powershell feature
I think there is cmdlet which can help you in this case for this
Check it please