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 / Moving a folder to sub...
Power Automate
Answered

Moving a folder to subfolders

(0) ShareShare
ReportReport
Posted on by 44

Hello! I was wondering if someone could help me. Right now, my flow creates a new folder when a new item is created in the list. If an attachment is also added, it shows in the new folder as well. I want to move a folder into these subfolders I have (so it goes year --> region -----> date). 

 

Screenshot 2024-05-27 111212.pngScreenshot 2024-05-27 111832.pngScreenshot 2024-05-27 112208.png

Categories:
  • Nived_Nambiar Profile Picture
    18,138 Super User 2026 Season 1 on at

    Hi @Aye3 

     

    so you want to move the folder which is created when an item is created in list into the folder structure defined by year>region>date, so does the year , region date values are coming from item field values which is created ?

     

    could you please clarify it ?

     

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel
    Blog: Nived Nambiar's Blogs

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

     

  • Aye3 Profile Picture
    44 on at

    Yes the region and date are coming when the new item is created

  • Nived_Nambiar Profile Picture
    18,138 Super User 2026 Season 1 on at

    Hi @Aye3 

     

    what about year - is it taken from date ?

     

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel
    Blog: Nived Nambiar's Blogs

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

     

  • Aye3 Profile Picture
    44 on at

    Oh yes, year is also taken in date too.

  • Nived_Nambiar Profile Picture
    18,138 Super User 2026 Season 1 on at

    Hi @Aye3 

     

    I have created a sample flow for this

     

    see below

     

    I have added these columns in a sharepoint list which represent date and region.

    Nived_Nambiar_0-1716833389321.png

     

    Now the folder would be created in a Test folder which is under Shared Documents

    Nived_Nambiar_1-1716833418747.png

     

     

    Now let's proceed to flow design

     

    1. Use trigger when item is created so to trigger flow when item is created

    Nived_Nambiar_2-1716833461510.png

     

    2. Use create folder in nested mode like year/region/date (you can add one more layer of folder as well)

    Nived_Nambiar_3-1716833581117.png

     

    Test/@{formatDateTime(triggerOutputs()?['body/Date'],'yyyy')}/@{triggerOutputs()?['body/Region']}/@{formatDateTime(triggerOutputs()?['body/Date'],'yyyy-MM-dd')}

     

    3. get list of attachments associated with the list item

    Nived_Nambiar_4-1716833635584.png

     

    4. Now loop through the list of attachments and do the following steps

    Nived_Nambiar_5-1716833681878.png

     

    4.1- Get attachment content of the attachment as shown below

    Nived_Nambiar_6-1716833745949.png

     

    Nived_Nambiar_7-1716833770998.png

     

    Now after that use create file to create the file with content from get attachment content action

    Nived_Nambiar_8-1716833830978.png

     

    Nived_Nambiar_9-1716833858523.png

     

    Nived_Nambiar_10-1716833876136.png

     

     

    Hope this helps !

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel
    Blog: Nived Nambiar's Blogs

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

     

  • Aye3 Profile Picture
    44 on at

    Thanks for the sample flow. However, I am getting an error when I run this:

     

    Screenshot (93).png

     

    Also, I have a question. I was using the folder path to name the folder because it has to be a specific name. If I can't use the folder path, how else can I name the folder?

  • Nived_Nambiar Profile Picture
    18,138 Super User 2026 Season 1 on at

    Hi @Aye3 

     

    For the error- formatDateTime except input as string of datetime, but you have passed number due to which it throws error- could you please what value u have passed?

     

    Also here Create folder accepts nested folder path if it is not exists- it will create it.  In your case, you are creating a folder and then moving the folder to nested folder which has structure like year>region>date, so instead of that create a nested folder with folder structure as year/region/date/folder_name and then create the attachment file inside that.

     

    Hope it helps !

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel
    Blog: Nived Nambiar's Blogs

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

     

  • Aye3 Profile Picture
    44 on at

    Sure, this is what the code says:

     

    Screenshot (96).png

  • Nived_Nambiar Profile Picture
    18,138 Super User 2026 Season 1 on at

    Hi @Aye3 

     

    The trigger outputs expression which you have used should be like - triggerOutputs()?['body/Date'] instead of triggerOutputs('body/Date']

    Simmilary for other expression where u have used triggerOutputs

     

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel
    Blog: Nived Nambiar's Blogs

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

     

  • Aye3 Profile Picture
    44 on at

    I fixed the trigger output expressions but I am still getting an error.

     

    Screenshot (97).png

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 July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 229 Super User 2026 Season 2

#2
11manish Profile Picture

11manish 223 Super User 2026 Season 2

#3
Valantis Profile Picture

Valantis 136 Super User 2026 Season 2

Last 30 days Overall leaderboard