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 / Rename files automatic...
Power Automate
Answered

Rename files automatically in OneDrive for business getting the folder name as a prefix

(0) ShareShare
ReportReport
Posted on by 14
Dear all, I am trying to create a flow where a file, which is saved in a OneDrive for busines folder is renamed and gets the name of the folder as a prefix.
Example: The folder is called "12259G1515" and the file is called "zk.pdf". When I drop the file in the folder, I would like it to have the name "12259G1515-zk.pdf".
 
I tried various ways, but unfortunately it did not work out. Does someone have an idea how the flow might look like?
Categories:
  • Verified answer
    v-zhoqian-msft Profile Picture
    Microsoft Employee on at

    Hi @Hauke_Pay,

     

    You could refer to the following flow:

    vzhoqianmsft_0-1680765077650.png

    Expression:

    split(triggerOutputs()?['body/Path'],'/')
    concat(variables('arr')[sub(length(variables('arr')),2)],'-',last(variables('arr')))

     

    We can separate the path of the file into an array with "/", and concatenate the penultimate and last items into new file name.

    vzhoqianmsft_2-1680765724914.png

     

     

     

    Best Regards,

    Community Support Team _ habsburg Qian

    If this post helps, then please consider Accept it as the solution to help the other members find it.

     

     

     

  • Hauke_Pay Profile Picture
    14 on at

    Hi @v-zhoqian-msft ,

     

    thanks for the reply. The flow looks very good. Unfortunately I cannot find compose/compose2 in my actions. Do you know what the problem is?

    1.png

  • v-zhoqian-msft Profile Picture
    Microsoft Employee on at

    Hi @Hauke_Pay ,

     

    It seems that you are not using the English version, so you may not be able to search for 'Compose' action. You could search for the name of the action in your language or switch to the English version.

     

    Best Regards,

    Community Support Team _ habsburg Qian

    If this post helps, then please consider Accept it as the solution to help the other members find it.

  • Hauke_Pay Profile Picture
    14 on at

    Hi @v-zhoqian-msft,

     

    I almost got it. I built the flow but now I am getting an error. Please see the attached screenshot.

    2.png

  • v-zhoqian-msft Profile Picture
    Microsoft Employee on at

    Hi, @Hauke_Pay 

     

    It seems that the 'Initialize variable' did not obtain the value of file path. It is null.

    Could you share more details about your flow, such as the formulas in each action and the running results of each action.

     

    Best Regards,

    Community Support Team _ habsburg Qian

    If this post helps, then please consider Accept it as the solution to help the other members find it.

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
Mohsin Ali Profile Picture

Mohsin Ali 430

#2
11manish Profile Picture

11manish 341 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 282

Last 30 days Overall leaderboard