Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Move folder to 2024 year folder based on date metadata

(0) ShareShare
ReportReport
Posted on by 1,597 Super User 2024 Season 1

Hello,

In the below flow, employee folders are stored in the "/EmployeeFiles/Current" folder. When the employee leaves, their leaving date is added as metadata to their folder. This then trigger the flow and moves their folder to the "EmployeeFiles/Leavers" folder.

In the Leavers folder, we have folders for 2023 and 2024 - essentially what we want to happen is that if someone has a leaving date in the year of 2024, then their folder should move to "EmployeeFiles/Leavers/2024".

 

It would be useful to find out how this can be achieved.

 

Thanks! 🙂

 

sudosaurus_0-1712676040857.png

 

  • Verified answer
    sudosaurus Profile Picture
    1,597 Super User 2024 Season 1 on at
    Re: Move folder to 2024 year folder based on date metadata

    @creativeopinion 

    I have solved this by adding in a 'Get file properties' action and a new 'Compose' action to get the Leaving Date value and use this to get the Year value - the folder is now moving to the leavers/2024 folder as required.

     

    sudosaurus_1-1712745533978.png

     

  • sudosaurus Profile Picture
    1,597 Super User 2024 Season 1 on at
    Re: Move folder to 2024 year folder based on date metadata

    @creativeopinion this first bit is outputting with a true/false value rather than a date

    sudosaurus_0-1712740853667.png

    The 'LeavingDate' column in SharePoint is a date column. So maybe the expression is wrong? empty(triggerOutputs()?['body/LeavingDate'])

  • creativeopinion Profile Picture
    10,450 Super User 2025 Season 1 on at
    Re: Move folder to 2024 year folder based on date metadata

    @sudosaurus What this tells me is that the dynamic content you are using is outputting a boolean (true/false)—not a date. 

     

    Please confirm the output of the dynamic content you are using (in the expression) by placing the dynamic content (just the dynamic content) into its own Compose action and showing a screenshot of the output.

     

    I believe you are selecting the incorrect dynamic content in your expression. You need to ensure that you are selecting the dynamic content for the date column. What you are selecting is the dynamic content for whether or not the date column has been changed (which returns a true/false).

     

    For more flow troubleshooting tips—check out this YT Tutorial: 5 Power Automate Troubleshooting FAQs and Helpful Tips for Creating Better Flows

     

    In this Power Automate tutorial, I explore 5 frequently asked questions that pop up when troubleshooting a flow. If you’d like to to level up your Power Automate flow skills and learn how to troubleshoot your Power Automate flow—this tutorial is for you!

     

    IN THIS VIDEO:

    ✅ How to troubleshoot a false Condition action result

    ✅ How to get dynamic content when it isn’t selectable from the list of dynamic content

    ✅ How to troubleshoot an Apply to Each action that isn’t looping through

    ✅ How to troubleshoot a skipped Apply to Each action

    ✅ How to troubleshoot a Filter Query

    ✅ How to use a SharePoint yes/no column in a Filter Query

    ✅ How to use Compose actions to troubleshoot a Power Automate flow

    ✅ How to troubleshoot multiple emails being sent

    ✅ How to troubleshoot multiple Teams messages being sent

     

    Hope this helps!

    If I helped you solve your problem—please mark my post as a solution ✅.
    Consider giving me a 👍 if you liked my response!

    👉 Level up your Power Automate skills by checking out my tutorials on YouTube
    👉 Tips and Tricks on TikTok and Instagram

  • sudosaurus Profile Picture
    1,597 Super User 2024 Season 1 on at
    Re: Move folder to 2024 year folder based on date metadata

    @creativeopinion when I use the above expression, I get this output:

    sudosaurus_0-1712694780067.png

     

  • creativeopinion Profile Picture
    10,450 Super User 2025 Season 1 on at
    Re: Move folder to 2024 year folder based on date metadata

    @sudosaurus The function is formatDateTime(). You'll need to use: 

    formatDateTime(outputs('Compose-LeavingDate'),'yyyy')
    What happens when you use the above expression?
  • sudosaurus Profile Picture
    1,597 Super User 2024 Season 1 on at
    Re: Move folder to 2024 year folder based on date metadata

    @creativeopinion unsure if I've done something incorrect here:

     

    sudosaurus_1-1712678760429.png

    sudosaurus_2-1712678808799.png

    I also tried: 

    formatDateTime(outputs('Compose-LeavingDate'),'yyyy')

     

     

  • creativeopinion Profile Picture
    10,450 Super User 2025 Season 1 on at
    Re: Move folder to 2024 year folder based on date metadata

    @sudosaurus Use the formatDateTime() function to get the year from your date column. 

     

    creativeopinion_1-1712677650293.png

    I'm just using a Compose action to store a date in my case, so that's what I'm referencing in the expression. Use the 'yyyy' datetime format pattern.

     

    creativeopinion_0-1712677635527.png

     

    Append the output from the Compose action storing the year into the Destination folder field. Note: The cursor in Power Automate jumps around when you do this, it may delete the forward slash in front of the dynamic content, which you'll need to add back in.

    creativeopinion_2-1712677763802.png

     

    Hope this helps!

    If I helped you solve your problem—please mark my post as a solution ✅.
    Consider giving me a 👍 if you liked my response!

    👉 Level up your Power Automate skills by checking out my tutorials on YouTube
    👉 Tips and Tricks on TikTok and Instagram

     

     

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1