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 folder to 2024 ye...
Power Automate
Answered

Move folder to 2024 year folder based on date metadata

(0) ShareShare
ReportReport
Posted on by 1,599 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

 

Categories:
  • creativeopinion Profile Picture
    10,508 Moderator on at

    @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

     

     

  • sudosaurus Profile Picture
    1,599 Super User 2024 Season 1 on at

    @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,508 Moderator on at

    @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,599 Super User 2024 Season 1 on at

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

    sudosaurus_0-1712694780067.png

     

  • creativeopinion Profile Picture
    10,508 Moderator on at

    @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,599 Super User 2024 Season 1 on at

    @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'])

  • Verified answer
    sudosaurus Profile Picture
    1,599 Super User 2024 Season 1 on at

    @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

     

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 317 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 247

#3
Henil Profile Picture

Henil 117

Last 30 days Overall leaderboard