Sign in to follow this  
Followers 0
kalans

Get Path From String

5 posts in this topic

#1 ·  Posted (edited)

Hello, I have look around for a function and used search to find my exact answer but no luck.

I have a location of a file (string), but need to know the directory the file is in.

Example:

"C:Program Files (x86)The DirThe File.exe"

and I need it to be

"C:Program Files (x86)The Dir"

But I can't do any trimming, due to if they have a different name on the exe "TheFile.exe". Now I can get rid of the .exe part by using StringReplace but I do not know where to go from here XD.

Help would be most appreciated! Thanks!

Edited by kalans

Share this post


Link to post
Share on other sites



Function _PathSplit does what you need:

"Splits a path into the drive, directory, file name and file extension parts."

You then simply concatenate the parts you need: drive and directory.

BTW:

keyword "game" might trigger some unpleasant reactions. Be sure you carefully read the forum rules!


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

What's wrong about _PathSplit?

All you have to do it to put the pieces together.

A word of advice: be careful about any game related issue; if you haven't read the forum rules yet, I would suggest reading them asap.


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

Wonderful help guys :), and yes I am sorry for that..I have corrected the word used.

Share this post


Link to post
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
Sign in to follow this  
Followers 0