web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Copying files to newly...
Power Automate
Answered

Copying files to newly created folders

(0) ShareShare
ReportReport
Posted on by 42

I have been creating flows in Power Automate Desktop for over a year.  Despite some knowledge of the actions in PAD and how to troubleshoot issues, I'm completely stumped by the following situation.

 

I have a flow that creates two folders on our server for each file in an origination folder.  The flow is supposed to copy each file from that origination folder to the associated two newly created folders.  It's completely hit or miss as to whether the copying happens and I have yet to have it happen for both of the newly created folders for a file.  To troubleshoot the issue, I have tried a number of different things.  First, I wondered if there needs to be some delay between the act of creating the folders and the act of copying of the file to those folders.  So, instead of copying the file right after (with a WAIT action in between) creating the new folders, I wrote the new folder locations to an excel spreadsheet and then I read the spreadsheet to identify those folder locations and try to copy the file to the read folder locations.  That didn't help.  I then simplified the process by only including a single file in the origination folder.  I recreated a portion of the flow into a new PAD flow and set the two newly created folder locations on the server as variables in that new PAD flow.  The new PAD flow runs perfectly.  All the variable values are correct and this should work, but it doesn't.  I am completely stumped.  

 

The first image below is the flow where I read from the excel spreadsheet.  The second image is the new PAD flow where I set the folder locations as variables.  NOTE: The newly created folder locations CANNOT be statically set.  These locations are determined for each file.

 

jharrity_0-1677602259509.png

 

The flow for testing the above with the variables statically set.

 

jharrity_1-1677602353204.png

 

I have the same question (0)
  • jharrity Profile Picture
    42 on at

    I'm not an expert at reading error logs, but I ran the flow so it would throw the error and it gave me the following error:

     

    Microsoft.Flow.RPA.Desktop.Modules.SDK.ActionException: Source folder doesn't exist ---> System.IO.DirectoryNotFoundException: Could not find a part of the path 'K:\0099 (XXX)\0199C2 (2018OSBMS005US03)\2023-02-28 - Non-Final Office Action \2018OSBMS005US03 Non-Final Office Action dated 02-27-23.pdf'.
    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
    at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
    at Microsoft.Flow.RPA.Desktop.Modules.File.Actions.CopyFileAction.CopyFile(FileObject source, FolderObject destination, Boolean overwrite)
    --- End of inner exception stack trace ---
    at Microsoft.Flow.RPA.Desktop.Modules.File.Actions.CopyFileAction.CopyFile(FileObject source, FolderObject destination, Boolean overwrite)
    at System.Linq.Enumerable.<SelectManyIterator>d__17`2.MoveNext()
    at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
    at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
    at Microsoft.Flow.RPA.Desktop.Modules.File.Actions.CopyFileAction.Execute(ActionContext context)
    at Microsoft.Flow.RPA.Desktop.Robin.Engine.Execution.ActionRunner.Run(IActionStatement statement, Dictionary`2 inputArguments, Dictionary`2 outputArguments)
     

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    does this look correct?

     

    K:\0099 (XXX)\0199C2 (2018OSBMS005US03)\2023-02-28 - Non-Final Office Action \2018OSBMS005US03 Non-Final Office Action dated 02-27-23.pdf

  • Verified answer
    jharrity Profile Picture
    42 on at

    "K:\0099 (XXX)\0199C2 (2018OSBMS005US03)\2023-02-28 - Non-Final Office Action \" (I see there is a space in there after "Action") is a correct identification of an example newly created folder location and "2018OSBMS005US03 Non-Final Office Action dated 02-27-23.pdf" is an example of a file name.  So, together it is an example of the file after it has been moved to the newly created folder. 

     

    I had been doing some additional reading about how unstable the copy function is in PAD.  Someone suggested using the DOS Command instead.  I did that and it worked perfectly and reliably.   

  • poa Profile Picture
    6 on at

    @jharrity could you elaborate on which DOS Command you used?

     

    Thanks

  • jharrity Profile Picture
    42 on at

    @poa , Please see below.  I set a variable to the DOS command that I wanted to run.  In this case, it was a copy command.  Then, I ran the action "Run DOS command."  Pretty simple.  If you are unfamiliar with DOS commands, there are plenty of resources out there to help you.  I had to refresh my memory because it had been decades since I wrote DOS commands.

     

    jharrity_0-1690898719455.png

     

    jharrity_1-1690898792758.png

     

  • poa Profile Picture
    6 on at

    @jharrity Sorry to resurrect an old thread the way I did, and thank you so much for your response.  This was incredibly helpful.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 262 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 167

#3
Haque Profile Picture

Haque 154

Last 30 days Overall leaderboard