Jump to content

Get the file name and the file directory from a file path


Rofellos
 Share

Recommended Posts

TheSaint,

I considered that the function is not just versatile Harvester. Need a balance between speed and versatility. For any particular case I create function. If I need to get the path without the file extension, I'm not going to split it, then merge.

Very true, there is benefit in that, and using your approach with more array returns, would be a good way to go, and more true to the style of AutoIt functions.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

WinAPIEx has an array of functions that do a safer job than _PathSplit in my humble opinion.

Yes, that's one of the ways AutoIt use has changed, with many native functions now being supplanted with API ones. More powerful for sure, but definitely one of those things I mentioned elsewhere, that have been changing the face of AutoIt.

Oh, and I was about to amend _PathSplit as an example, but it appears I don't need to anymore.

Don't follow you there, unless you mean AZJIO's function (which would need amending) or my lack of drive/interest without support or the API alternative? Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

I have also been distracted today, whilst putting this baby together.

My first real decent BBQ, which I christened for dinner late this evening.

A surprise Xmas present from daughter & wife.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

  • 4 years later...
  • 11 months later...

Func _Lay_Ten_File($FileFullPath)

    While 1
        $ViTriThu1CuaDauPhay = StringInStr($FileFullPath, "\")

        If $ViTriThu1CuaDauPhay = 0 Then
            Return $FileFullPath
        Else
            $FileFullPath = StringTrimLeft($FileFullPath, $ViTriThu1CuaDauPhay)
        EndIf
    WEnd

EndFunc   ;==>_Lay_Ten_File

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...