kalans Posted February 19, 2012 Posted February 19, 2012 (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 February 19, 2012 by kalans
water Posted February 19, 2012 Posted February 19, 2012 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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
enaiman Posted February 19, 2012 Posted February 19, 2012 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 :)
kalans Posted February 19, 2012 Author Posted February 19, 2012 Wonderful help guys , and yes I am sorry for that..I have corrected the word used.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now