cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate II
Advocate II

Microsoft Flow: Get files (properties only) of file only in a specific folder

I'm trying to copy all the files in a folder(excluding the sub-folders) I have in SharePoint using the "Get files (properties only)" action. I tried to use the "Filter Array" action to filter out the list using the folder path. The filter array is working fine but I'm not able to use that in the Copy file Action. 

 

I have seen a similar question asked before, but that did not have a solution I'm looking for. It had a workaround, but I'm looking for a simpler solution.

Copy filesCopy files

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Hi @Gangula,

 

I did a test on my side, and fields like {Path} seem to be invalid in Filter Query.

Using Filter array is a good choice, I have configured it based on what you provided.

In the condition of the Filter query, a judgment is added to check whether the item under this path is a folder. If it is a folder, it needs to be excluded.

Formula reference:

@and(equals(item()?['{Path}'], 'Copy/Test123/'),equals(item()?['{IsFolder}'], false))

Then use items(‘Apply_to_each’)[‘ {Identifier}’] in File to copy field to get the Id of the filtered files, then copy the file to the destination.

Image reference:

47.PNG

Please take a try.

 

Best Regards,

Barry

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

View solution in original post

7 REPLIES 7
Highlighted
Community Support
Community Support

Hi @Gangula,

 

I did a test on my side, and fields like {Path} seem to be invalid in Filter Query.

Using Filter array is a good choice, I have configured it based on what you provided.

In the condition of the Filter query, a judgment is added to check whether the item under this path is a folder. If it is a folder, it needs to be excluded.

Formula reference:

@and(equals(item()?['{Path}'], 'Copy/Test123/'),equals(item()?['{IsFolder}'], false))

Then use items(‘Apply_to_each’)[‘ {Identifier}’] in File to copy field to get the Id of the filtered files, then copy the file to the destination.

Image reference:

47.PNG

Please take a try.

 

Best Regards,

Barry

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

View solution in original post

Highlighted

@v-bacao-msft, Thank you for the reply. Based on your solution I found another way to solve the issue. 

 

Copy files from specific folderCopy files from specific folder

 

 

 

 

 

 

 

Highlighted

I have the same issue, but now I'm running up against the 100 item limit for the SharePoint Get files (properties only) action [edited to correct action name].  If I could filter the items directly in the Get files (properties only) action [edited to correct action name], then I would be fine.  But, if I can't filter by folder path until after the Get files (e.g. by using filter array), than I have no way around the 100 item limit.

 

If that isn't clear, imagine a big document library with 3000 or so files.  All the files are similar, but I want the 30 or so files in a particular folder.  If there is nothing else unique or identifying about these folders except for their folder path, how could I use flow to get those 30 files?  It seems impossible.

 

The only option I see is adding some sort of column to the library and seeing if that is filterable in the Get files (properties only) action [edited to correct action name], and use that like a key of some kind.

Highlighted

@BTbearings,
Top count: 5000
Do not trust that "(default=all)"
Highlighted
Regular Visitor

My flow stopped working because there were more than 100 files in the document library. Changing the top count to 5000 solved my problem!!! Thanks!! Have been trying to figure this out for hours!

Highlighted

That totally fixed it!!  Thanks!

Highlighted

Exactly right.  Frustrating that it doesn't work as indicated and you have to find a post from @lk777 to figure it out!  Thanks!!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (7,796)