Showing results for 
Search instead for 
Did you mean: 
Helper III
Helper III

Extract the file name and move to specific folder


I am building a flow when a file is created in sharepoint, so the files will be moved to the specific folder based on the first few letter of the file name. For example, the file is uploaded with name "Production plan 0527", so it will be moved to a folder name production plan. How should I achieve this?

Super User
Super User

First of all, I would recommend trying. ‌‌😉

Second of all, if you have made an attempt, let us have a look, and just obfuscate anything sensitive in your screenshots. Be sure to edit them into the original question, too.


Lastly, this should get you started:

  1. Start the flow with a When a file is created in a folder SharePoint trigger, and point it to the folder. This will start the flow on items added.
  2. Next have a Get file metadata SharePoint action that runs on the x-ms-file-id value from the trigger. That should get you the file name.

From here on out, you will need to build your own logic using the Move file action and whatever else you need to do. But if all the files are just going into one folder, then that's your next action.


That's all, really. 🙂

Hi @eliotcole ,

Sorry, I didn't make myself clear. 

Actually the file keep changing day by day, like today is "production plan 0530", tomorrow is "production plan 0601". What I would like to do is to extract the first few character, in this case is first 14 characters. what I can think of is to add a compose, but I don't know how to formulate to make it extract the first few characters. Hope this clarify.

Helpful resources

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (2,029)