Skip to main content

Notifications

Community site session details
Power Automate - Building Flows
Answered

File Directory, not full path with filename

Like (0) ShareShare
ReportReport
Posted on 30 Aug 2019 16:26:22 by 433

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?

  • Verified answer
    akharns Profile Picture
    433 on 05 Sep 2019 at 21:14:22
    Re: File Directory, not full path with filename

    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.

  • abm abm Profile Picture
    32,464 Most Valuable Professional on 05 Sep 2019 at 20:46:18
    Re: File Directory, not full path with filename

    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

  • akharns Profile Picture
    433 on 05 Sep 2019 at 20:21:35
    Re: File Directory, not full path with filename

    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.

  • akharns Profile Picture
    433 on 05 Sep 2019 at 15:45:12
    Re: File Directory, not full path with filename

    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.

  • abm abm Profile Picture
    32,464 Most Valuable Professional on 04 Sep 2019 at 00:13:13
    Re: File Directory, not full path with filename

    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

     

  • akharns Profile Picture
    433 on 03 Sep 2019 at 22:02:50
    Re: File Directory, not full path with filename

    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".

  • abm abm Profile Picture
    32,464 Most Valuable Professional on 03 Sep 2019 at 21:36:25
    Re: File Directory, not full path with filename

    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

     

     

  • akharns Profile Picture
    433 on 03 Sep 2019 at 20:23:22
    Re: File Directory, not full path with filename

    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.

  • abm abm Profile Picture
    32,464 Most Valuable Professional on 03 Sep 2019 at 20:09:34
    Re: File Directory, not full path with filename

    Hi @akharns 

     

    I was asking which flow action step you are getting these properties from?

     

    See below these are my properties under List files in folder. As you can see when I filter by text as 'list' no properties are displayed under. You must have a different flow action step here?

     

    prop2.png

     

    Thanks

     

     

  • akharns Profile Picture
    433 on 03 Sep 2019 at 19:55:10
    Re: File Directory, not full path with filename

    List of Files Path and List of Files Name

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,743 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,079 Most Valuable Professional

Leaderboard
Loading started
Loading started
Loading complete