Showing results for 
Search instead for 
Did you mean: 
Regular Visitor

Place email attachments into a network drive folder whose name starts with the string in the Subject line

EDIT: I can't delete this so I'll just give a summary of what I've reverted to doing...

So I got a "recursive" search working using nested "List files in folder" commands in combination with the IsFolder boolean, but I learned that my team puts their project folders at inconsistent subfolder depths. So trying to find their Project folder using a mix of If conditions and Name "Starts with" Subject conditions would get messy and might take too long to process by Flow. But it's possible to do. Luckily they store the project folder path in tangential software that has API capabilities, so I'm going to try calling the project folder path via the API instead...


So far, I have the following, which successfully places email attachments (i.e., "proof of delivery" photos) into a network drive folder.



However, instead of dumping all the photos into a single folder...

  • I need the "proof of delivery" photos to go into the corresponding project folder (which are named "<Project #> <Name of Project>".
    • The user will specify the Project # in the subject line.
  • Additionally, each photo should be named "<Email Body Text> 1.jpg", "<Email Body Text> 2.jpg", "<Email Body Text> 3.jpg", etc.

In summary, here's a step-by-step of how I'd like the Flow to operate:

  1. The user attaches the "proof of delivery" photos to an email addressed to the shared mailbox in my Flow (ex: "").
  2. The user specifies the project # in the subject line (ex: "123456").
  3. The user specifies the name format of the photos in the email Body (ex: "10_6 Delivery by Jon Doe").
    1. If no text is found in the email body, default to "MM_D Delivery by <First & Last Name of the sender, pulled from AD/M365>" (where "MM" is month and "D" is day)
  4. The user sends the email.
  5. Flow recursively searches the folders & subfolders in the network drive for a folder name that begins with the subject line (i.e., "123456")
  6. Once the folder is found, Flow places all the attached photos into that folder, using the naming convention specified in the email's Body (i.e., "10_6 Delivery by Jon Doe 1.jpg", "10_6 Delivery by Jon Doe 2.jpg")
    1. If the Project # folder is not found, put the folders in a "Delivery Photos Lost & Found" folder on the root of the network share.

The reason I need to do a recursive search on the folders & subfolders on the drive is because the Project folders are nested within the corresponding company's folder. (e.g., "\\<Server>\<Share>\<CompanyName>\<Project #> <Project Name>\3-Installation Documents\Proof of Delivery\<PhotoName>.jpg").

For example, here's where the photos would be placed if the user specified the "63466" Project # in the Subject line :



Under File System, I see a "List files in folder" action...



...but no Find Files in Folder (which I think is more along the lines of what I need) like OneDrive has:



Seemingly without a built-in function to recursively search for a specific folder name, I'm afraid I'll have to use the List files in folder operation one-by-one on each company folder (assuming List files in folder also lists folder names, and not just file names) until I find the folder that starts with the Project # the user specified in the Subject line.


If assisting with my entire flow is too much to ask for a single post, this post is primarily for asking assistance with recursively searching for a folder name on a network drive that starts with the text in an email's Subject line (and putting Email attachments into its "\3-Installation Documents\Proof of Delivery" subdirectory).


Thank you in advance for any 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!

Top Solution Authors
Top Kudoed Authors
Users online (2,790)