VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Filename only from a path

Stewart MacFarlane  (2 Submissions)   Files/File Controls/Input/Output   Visual Basic 3.0   Beginner   Wed 3rd February 2021

Ever wanted to extract a filename only from a path including the filename, well this simple function will do it for you! (I know its not ground breaking but its simple easy and useful)

Inputs
call the function like this: get_filename_only(filepath$) where filepath$ is a variable containing a filepat and filename or get_filename_only("c:\windows\notepad.exe") change the path to suit your needs

Assumes
put this code into a module (.bas) and call from the program as explained above

Returns
the filename only (incl. extension) or a message telling you to check the path if it cant find a valid path in the string you sent to it.

Rate Filename only from a path (4(4 Vote))
Filename only from a path.bas

Filename only from a path Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters