web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Moving files to 31 dif...
Power Automate
Unanswered

Moving files to 31 different folders in Sharepoint based on file name

(0) ShareShare
ReportReport
Posted on by 12

Hi everyone,

 

I built a flow to collect responses from forms pro, populate word template, convert them to pdf and save them in a folder in Sharepoint. The files are saved as "Applicant Name - City of applicant.pdf"

 

There are about 31 folders in my sharepoint library for each of these cities. I want to move these pdfs as they come along, to each of their folders based on the city of applicant in the file name.

 

I've tried a lot of things but nothing seems to work. I need your expertise!

 

I'd appreciate any help, thank you!

Categories:
I have the same question (0)
  • ChristianAbata Profile Picture
    8,951 Most Valuable Professional on at

    please @nhollo  cloud you share an screanshot?

  • nhollo Profile Picture
    12 on at

    Sure, this is what it looks like now:

    The move file details were filled obviously 🙂

     
     
  • ChristianAbata Profile Picture
    8,951 Most Valuable Professional on at

    its empty jejeje @nhollo 

  • nhollo Profile Picture
    12 on at

    it's not allowing me to post the photo!! I attach it and it keeps disappearing when I actually post the message.

     

    Basically it is:


    When a file is created

    Condition: File Name contains "City Name"

    If yes: Move file 

  • Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    If the files all have a '-' in the filename just before the city name, then I would do a split on '-' and then grab the first word of the second array index item.  That will be the city name.  Then you can run a Switch statement based on the value of the cityname and run the appropriate file move

  • nhollo Profile Picture
    12 on at

    Thank you @Pstork1 . I will try that. Would you mind explaining how I could do the Switch?

  • nhollo Profile Picture
    12 on at

    Capture.PNG

     

     

     

     

     

     

    @Pstork1  It didn't seem to work..

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @nhollo 

     

    The below flow steps will give you a head start.

     

    image.png

     

    My library name is 'aj'

     

    The expression I used to find the city name is as follows

     

    trim(first(split(last(split(variables('Filename'), '-')),'.')))
     
    My Test Result
    image.png
     
    Thanks
  • nhollo Profile Picture
    12 on at

    @abm thank you for the reply. It fails when I try to move the file.

     

    I'm a noob at variables.. so what i need to extract is "- CityName"

     

    Will the trim function still be the same?

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @nhollo 

     

    Thanks for your reply

     

    Declare another compose and add the below.

     

    - Output('Compose)

     

    Thanks

     

     

     

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard