Jump to content

StringSplit FilePath


Recommended Posts

I have been working on this forever. How can you use StringSplit to get the filename only and not the whole path. I tried using something like

$Path = StringSplit("C:\test\testfolder\test.txt", "\", 1)

Well the thing is how can you determine what the last value of the array is without knowing the number of the array??

Anybody know?

Edited by EndFunc
EndFuncAutoIt is the shiznit. I love it.
Link to comment
Share on other sites

By good ol' SmokeN (This Thread):

$url = 'http://www.somepath.com/and/so/on/etc/filename.ext'
$aurl = StringTrimLeft($url, StringInStr($url, '/', 0, -1))
MsgBox(0, '', $aurl)
oÝ÷ Ûú®¢×©ä°"[¬zØZ¶Þjëh×6$SplitFile = StringSplit("C:\test\folder1\folder2\myfile.text", "\")
    _ArrayReverse($SplitFile, 1)
    MsgBox(0,0, $SplitFile[1])
! I was playing around and actually got this to work. Pretty crude :shocked: but it worked.
EndFuncAutoIt is the shiznit. I love it.
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...