GetFilenameWithoutPath()
Posted: Sat Jun 29, 2002 1:40 am
Code updated for 5.20+. Same as GetFilePart()
Restored from previous forum. Originally posted by WolfgangS.
Hi !
if you use a requester to get the file of your choice you get always the path AND the name. To extract the name out from the whole Path+Name try this procedure ...
MFG
WolfgangS
Restored from previous forum. Originally posted by WolfgangS.
Hi !
if you use a requester to get the file of your choice you get always the path AND the name. To extract the name out from the whole Path+Name try this procedure ...
MFG
WolfgangS
Code: Select all
FileNameWithExtension.s=""
Procedure.s GetFilenameWithoutPath(PAN$) ; Path And Name
For i=1 To Len(PAN$)
If Mid(PAN$,Len(PAN$)-i,1)="\"
ProcedureReturn(Right(PAN$,i))
EndIf
Next
ProcedureReturn(Right(PAN$,i))
EndProcedure
OpenConsole()
FileNameWithExtension=OpenFileRequester("","","",0)
PrintN("WholePath+Name = "+FileNameWithExtension)
PrintN("Just the Name = "+GetFilenameWithoutPath(FileNameWithExtension))
Delay(50000)