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 / Advanced file folder m...
Power Automate
Answered

Advanced file folder moving

(0) ShareShare
ReportReport
Posted on by 141

Hi,

Basically I'm looking for suggestions or help on how to create a flow that: (Would prefer power automate desktop) 

  • Scans a specific folder for their file names.
    • (We use job numbers e.g. "25647")
       
  • Then moves these to their matching folder name which would also be "25647" which is located in our Job server 

But I'm looking for a dynamic flow to do this for every 'existing match' in the first folder to then be moved to the second 'matched folder'. 

I'm really struggling to figure this out myself and I'm not sure if it's even possible with power automate so if someone knows if it is possible or not that would be very appreciated.

I have the same question (0)
  • OkanAutomation Profile Picture
    107 on at

    Easy way:

     

    2. Have an activity that opens the first file 

    3. Save this file by clicking or send keys activity: "ctrl" + "s"

    4. Save the filename you see after you open save window

    5. Remove the filename

    6. Save the file to the location by giving it as filename the location and the filename. Example:

    "C:/Users/John/Documents/example.txt" where example.txt is the filename. This will save the file to a location including a filename.

  • OkanAutomation Profile Picture
    107 on at

    At action 6 you will use a some hard coded value for the location, and a dynamic for the filename which you saved in action 4.

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Set variable %ToPath% to (the parent folder that contains all the project code folders)

    Get files from Folder to %Files%

    For each %CurrentItem% in %Files%

        'here we need to extract the folder name from the filename.  If it's always the first 5, that's easy, if not, you may have to do some heavy logic.  I have several articles at the link below on how to work with text inside of PAD to extract what you need.  Let's say you do what you need to do, and you are able to extract the folder name it is supposed to go to as %ToFolder%

        Move file %CurrentItem% to %ToPath%\%ToFolder%

    End (For Each)

     

    So, in English, this pulls all the filenames into a list, and 1 by 1 extracts the folder name from the filename and then moves that same file the folder identified in the filename.

     

    Best of luck.

     

     

     

     

     

    https://www.linkedin.com/in/michael-annis-80903/recent-activity/posts/

     

  • jkingno1 Profile Picture
    141 on at

    Thanks for your help, I will try this out and get back to you. Extremely appreciate it!

  • jkingno1 Profile Picture
    141 on at

    I have had a look at your linkedin articles and am still confused with how to get the data I need. So far I have created everything you said to and it works in getting all the file names. However I need to figure out how to move these files to their specific named folders. Is there possibly anything else you could suggest to help me. Heres a screenshot of what ive got at the moment. Thanks!Screenshot 2023-01-06 120938.jpg

  • jkingno1 Profile Picture
    141 on at

    Oh and to clarify it is always only the first 5

  • OkanAutomation Profile Picture
    107 on at

    Hi as i said you can try:
    - saving the file into path which is C:/Users/John/%FolderName%/%FileName%

  • jkingno1 Profile Picture
    141 on at

    Is there anyway you could demonstrate this as I find it hard to understand what you suggest to do exactly... Like how Michael demonstrated would make it more clear. And to be more clear on my end the files are images named by their specific job number. What you said earlier to this made no sense to me sorry

  • OkanAutomation Profile Picture
    107 on at

    You are pretty close,

     

    the path you created, is it general? So it is something like

    c\users\documents\folder\[here is the file you want to save to?]

     

    If yes, in the"[]" mark, you want to input a dynamic file name. It is you to decide if this file name is exactly the same as what the flow saves in files. the 5 numbers "25678", Have you checked if the flow saves the files as those exact names? Thats what you need and then use those names as input for intopath in activity 4 in combination with filepath. So in the end you will have

     

    Filepath

    Filename: make sure this is only 5 numbers, you can check by debugging it at activity 4, and then open the variable.

    In combination: %filepath%%filename%, is the value of activity 4. Keep in mind to have a backslash at the end of filepath aswell.

     

     

  • jkingno1 Profile Picture
    141 on at

    The path I created produces a list of all the files (Or images) I have in the folder. I think it will be easier to just show some images of what I've got. 

    Image 1.jpg

    Image 2.jpg

    image 3.jpg

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

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 246 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 176

#3
Haque Profile Picture

Haque 157

Last 30 days Overall leaderboard