cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
A-IT
Resolver I
Resolver I

Filter Query by File Name (Get files properties only)

I am trying to create a flow that will copy all files from one folder to other folders based on the file name. I was able to create the flow to copy all files in one folder to another single folder. Now I am trying to expand the usability by automatically sorting based on a portion of the file name.

Filter Query 2.png

I have my test files above. I want anything with '1A' in the name to be moved to Folder 1, '2B' moved to Folder 2, etc. I tried using an initializing variable and conditions, but it doesn't seem to be working since it's "Apply All". I am attempting to use the Query Filter for the file names highlighted in red.

Filter Query 1.png

I'm attempted the following ODOTA queries with no luck:
Name contains('1A')
Title contains('1A')
FileLeafRed contains ('1A')

I've also tried all the above with endswith. Any help of how to correctly write the query would be much appreciated. I would prefer a function like 'contains' so it will look anywhere in the file name for the characters I want. I believe if I can get this function working, I can alter it to other uses. Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
Paulie78
Super User
Super User

Try:

substringof('1A',FileLeafRef)

That should do what you need.

 

Please...

If I answered your question Accept it as a solution ✔️ 

If I helped you out, please give me some Kudos 👍

Thanks 😙

 

View solution in original post

2 REPLIES 2
Paulie78
Super User
Super User

Try:

substringof('1A',FileLeafRef)

That should do what you need.

 

Please...

If I answered your question Accept it as a solution ✔️ 

If I helped you out, please give me some Kudos 👍

Thanks 😙

 

@Paulie78 thank you! For my learning, when writing ODOTA, is it function first, then what you're querying, followed by which Cell you want to compare it to?

Helpful resources

Announcements
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,749)