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 / Move file to sharepoin...
Power Automate
Answered

Move file to sharepoint folder and/or create subfolder based on filename

(0) ShareShare
ReportReport
Posted on by 181

Hi all, i am beginner of building flow.

I want to building flow to move the 3 photos submitted from Power Apps to the folder based on the filename.

If the folder name not match with filename first 4 digit, it will create new folder that name is the filename first 4 digit and move the file inside there.

Then it will check the filename 5th and 6th digit, if not match, it will create new folder that name is the filename 5th and 6th digit and move the file insider there.

Next it will check the filename 7th and 8th digit, if not match, it will create new folder that name is the filename 7th and 8th digit and move the file insider there.

 

If folder existed, it will move to the last subfolder.

 

My file name format: ddddmmyy_1, eg:20220808_1

 

Now that i can upload the photo submitted from power apps to sharepoint and know that substring can extract file name

substring(outputs('Document_Number'),0, 6)

But i do not know whether need to create multi compose and how to make the condition to check the file name and folder name

 

Here attached the flow chart  and current flow for your easy reference.

test.drawio (2).png

AT_AlanTse123_0-1659927091956.png

AT_AlanTse123_1-1659927111336.png

 

 

Please forgive my poor English.

Thank you very much for your help

 

Categories:
  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @AT_AlanTse123 ,

     

    You can directly set the Folder Path, if the folder exists, the file will be placed in the specified path. If the folder does not exist, the corresponding folder will be created automatically.

     

    vbofengmsft_1-1660103226313.png

     

     

    concat('/YourLibraryName/',take(triggerBody()['text'],4),'/',substring(triggerBody()['text'],4,2),'/',substring(triggerBody()['text'],6,2))

     

     

     

    Best Regards,

    Bof

  • AT_AlanTse123 Profile Picture
    181 on at

    Hi Bof, 

    Thank you very much for your reply.

    I try your code on my flow, unfortunately, it is not success. 

    I think may be  'text' need to change to other thing, but I try anything  all is not success.

    Would you please help to check?

    substring(triggerBody()['text'],4,2)

    Below is my Power Apps Code:

     

     

    UploadaphototoSharePointfromPowerApps_V2.Run(Text( Now(), "dd-mm-yyyy hh:mm:ss" ) &"_1.jpg", Substitute(JSON(UploadedImage1.Image, JSONFormat.IncludeBinaryData),"""", ""));
    UploadaphototoSharePointfromPowerApps_V2.Run(Text( Now(), "dd-mm-yyyy hh:mm:ss" ) &"_2.jpg", Substitute(JSON(UploadedImage1_1.Image, JSONFormat.IncludeBinaryData),"""", ""));
    UploadaphototoSharePointfromPowerApps_V2.Run(Text( Now(), "dd-mm-yyyy hh:mm:ss" ) &"_3.jpg", Substitute(JSON(UploadedImage1_2.Image, JSONFormat.IncludeBinaryData),"""", ""));
    Reset(AddMediaButton1);
    Reset(AddMediaButton1_1);
    Reset(AddMediaButton1_2);

     

    Capture.PNG

    Thank you very much for your help.

  • Verified answer
    v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @AT_AlanTse123 ,

     

    First, please use the dynamic content of filename to replace the triggerBody()['text']. 

     

    vbofengmsft_0-1660108535714.png

    Or you can hover over the filename and you can get the expression for it.

    vbofengmsft_2-1660108705030.png

    Second, you need to click the 'Add dynamic content' and then input the expression I provided

    vbofengmsft_1-1660108568577.png

     

    Best Regards,

    Bof

     

  • AT_AlanTse123 Profile Picture
    181 on at

    Hi Bof,

     

    It works! Thank you very much for your help.

     

    You are genius

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

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 321 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 244

#3
Henil Profile Picture

Henil 102

Last 30 days Overall leaderboard