Showing results for 
Search instead for 
Did you mean: 
New Member

I am trying to create a Flow to create new folders from filenames in folder then move the files with that name into folder with same name.

I am trying to create a Flow to create new folders from filenames in folder then move files into folder with same name.

example: I have video files in a folder bob.mp4, bob2.mp4, joh3n.mp4, joh3n 31.mp4 ,sally.mp4 and jennifer.mp4 I am trying to have each file create a folder then move the files into that folder


folder created bob files inside new bob folder(bob.mp4 and bob2.mp4) folder created joh3n(john3n.mp4 john3n 31.mp4)
folder created sally(sally.mp4)folder created jennifer(Jenifer.mp4)


any help is greatly appreciated 


Hi @newbieJ 


I can take this:


and turn it into this:



WIth a flow like follows:

Get the files

Create an array with a select of the file name, no file extension (replace) and basing the folder on the first 4 chars (substring)

Get the unique values from the array with a union.



Then in the first apply to each, create the folders and the second, move the files to the new destination:



The bit that puzzles me is that I have used substring as I could not think of an easy way to identify the prefix or folder name based on some of the string matching.  Making each string 4 chars length made that match possible.


What do you think?


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

P.S. take a look at my new blog here and like & subscribe to my YouTube Channel thanks 😉


New Member

the example of what you can "take and turn it into" is exactly what I was looking to do.


I am sorry I am extremely new to all of this and have been trying to look at instruction videos, I am using the desktop version of power Automate and do not see how to grab or create the second picture with the  "select and compose  images variables " i do not see those options in the list,  is there any way to simplify it down or show the power Automate  desktop version way of doing it.  thank you again for your help. 

Helpful resources

Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (5,169)