|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Getting filename out of a full path
Hi Guys,
I'm using a vbs script for postprocessing image files. The application is use for opening the images call's a vbs file with "filename" as a parameter. Now the parameter "filename" contains the FULL path to the file. Since i need only the filename for some puposes is use a function to strip the filename out of the full path: Code:
Function GetFileName(Path) Path = Replace(Path, "/", "\") If (Len(Path) > 0) AND (InStrRev(Path, "\") <> Len(Path)) Then GetFileName = Right(Path, (InStrRev(Path, "\"))) Else Exit Function End If if i have this path: d:\test files\SS_9__IMG12535.jpg the function will translate this into: 2535.jpg Can anyone help me with this? Thx! |
|
#2
|
||||
|
||||
|
Hi,
try using the split function Code:
Function GetFileName(Path) Path = Replace(Path, "/", "\") tempPath = split(Path, "\") If Len(tempPath(uBound(tempPath))) > 0 Then GetFileName = tempPath(uBound(tempPath)) Else Exit Function End If hope this helps
__________________
Look! Its a ShemZilla ![]() ![]()
|
|
#3
|
|||
|
|||
|
THX M8!
This seems work fine for me! |
|
#4
|
||||
|
||||
|
no problem, glad its working
![]() |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Getting filename out of a full path |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|