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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Move files to another ...
Power Automate
Answered

Move files to another SharePoint site but first create a folder before files are moved

(1) ShareShare
ReportReport
Posted on by 22
Hello fellow Power Automate members, 

I have a SharePoint site and must COPY all the files from two Document Library folders (Documents and SOPs folder) to another SharePoint site (backup) on a monthly basis. 

I want to:

  1. Create the following folders on the on the SharePoint site (backup). 
  2. Only move the files from the first SharePoint site over to the SharePoint site (backup). 
The folders on the SharePoint site (backup) will be named as follows:
 

Documents_formatDateTime(convertTimeZone(utcNow(), 'UTC', 'Mountain Standard Time'), 'yyyy-MM-dd_HH-mm')

Standard Operating Procedures_formatDateTime(convertTimeZone(utcNow(), 'UTC', 'Mountain Standard Time'), 'yyyy-MM-dd_HH-mm')

 

Then the appropriate files will be moved into each of those folders. 

I am struggling with creating a folder before the files are copied over to the SharePoint site (backup). 

If you could please help me - I would really appreciate it!

Thank you!
 
Categories:
I have the same question (0)
  • Verified answer
    Michael E. Gernaey Profile Picture
    53,442 Super User 2025 Season 2 on at
     
    It would be a tiny bit easier if I could see your structure in SharePoint one but you would do this.
     
    1. You need to describe what the structure is of your source compared to your target
     
    For instance
     
    Documents/mydocs/1
    Documents/mydocs/2
    Documents/mydocs/3
     
    etc
     
    Target
    Documents/mydocs/1
    Documents/mydocs/2
    Documents/mydocs/3
     
    Now.. if you have it even more
     
    Documents/mydocs/eee/1
    Documents/mydocs/eee/ffff/1
     
    it gets really complicated because you need to parse the folder path of the source, take the pieces, and check if each piece(folder) exists on the other side and if not add it.
     
    can you give me a little detail on the format of the folders, just so I give you the simplest version of the code .
     
    which would look something like
     
    1. Reocurrence
    2. Get File (properties Only)
    3. Apply to Each (For Each)
    --Get the File Content First
    --Grab File Path (which I hope is just documents/folder
    --do a list folder Condition to see if the folder already exists on the other side
    ---In the Yes side, just do create File
    ---in the No, you would do a Create folder action
    -----then do your Create file
     
    but if your structure is.... deep or weird lol :-) then  I have to give you more code to do
  • CU06050106-0 Profile Picture
    22 on at
    Hi Michael, 
    i was able to get some help from our IT and did the PowerAutomate flow in this way. See attachment.
    Thank you all the same and for your quick response. 
     
  • Michael E. Gernaey Profile Picture
    53,442 Super User 2025 Season 2 on at
     
    So the issue I see and is why i wrote how i did, is that your flow doesn't have any error handling.
     
    As soon as you try to do the create if its there already you are going to get errors (and there are other situations that can arise).
     
    I am very happy you got it working
  • CU06050106-0 Profile Picture
    22 on at
    Hi Michael, 
     
    Thank you for the additional information. In my case, the export will be done and the individual will move the files onto a USB flash drive as a back up and take them to the appropriate locations on campus. 
     
    Once this is done, the SOP will instruct them to delete all files in the folder. Hence there will not be a an error in our case. Having said that, I appreciate knowing how to go about it so there is no errors. 
     
    I will mark this as answered. 
     
    Again, thanks!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard