cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper V
Helper V

File Directory, not full path with filename

The Path property contains the file name.  I want to store the File Name and the Directory separately.  How can I get just the directory, without the file name?

27 REPLIES 27

LOL.  This isn't the most effiecient mode of communication.  

 

Under Verify File Name (a condition), condition YES, I am invoking Add a row into Event Log (Excel insert row).  In the Source output field, I am using Expression and Dynamic Content to build the expression with these two fields.

Hi @akharns ,

 

Yes the gateway connection is working for me now. So I did built a flow similar like yours but I can't see those properties in my flow action step.

In your screen shot I can see properties List of Files File Locator, List f files Id, List of Files IsFolder etc... See my properties below. So that means there is something wrong with your flow action "List Files in folder". Where does you getting the above mentioned properties from?

 

Here is my flow and flow action properties.

prop3.png

 

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials

I don't know enough to know how List Of Files.... was created.  It's being triggered by When A File Is Created.  I wouldn't think there would be a "list of files".  

 

The odd part is that I don't get an error when using any field directly, without an expression, and I don't have a problem if I put this expression in a different output field, such as one I have called Notes.  There's something weird about that one field "source".

Super User III
Super User III

Hi @akharns 

Thanks for your reply. In your earlier screenshot you provided the trigger was manual and now I can see where the list of files properties are coming from. I did constructed a flow. Below are the steps for getting the filename and path. 

 

ak1.png

 

 

Expressions are as follows:

 
Variable SplitFilePathAndName expression:
split(variables('FilePathAndFileName'), '\')
 
Variable Filename expression:
last(variables('SplitFilePathAndName'))
 
Variable FilePath expression:
replace(variables('FilePathAndFileName'), variables('Filename'), '')

 

Below are my test results:

re1.png

re2.png

 

re3.png

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

 

Thanks

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials

I will give this a try, but is there a reason that my solution would not work?  A simpler solution (one step instead of several) sounds like a better, if possible.

I just ran a test, using your method and mine and they produced the same results.  I am convinced that the original problem was specific to the field I was writing it to.

Hi @akharns 

 

Glad to hear that it is resolved and thanks for the update.

 

If the below reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials

We have shown to valid ways to compute the file's directory, but we have not solved the problem.  How can I fix Flow or my Excel table so I can populate the Source column?  I tried thought if I deleted the column and re-added it in the table, it might do it, but it did not. 

 

I conclude that it can't  be fixed.  I can add a new column to the table and start using that.  I can't name it with the old name.

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Top Kudoed Authors
Users online (4,009)