Dim strMyPath, strFileName
strMyPath = "C:\TeamTask\Automation\Daily\EB\20140508\Test1_QTP"
strFileName = Mid(strMyPath, InStrRev(strMyPath, "\") + 1)
Extract a file name from the full file path
-
18-07-2023 - |
Pregunta
In VBScript how to separate Test1_QTP folder name alone from the below path. I need to extract "Test1_QTP" string into a variable.
C:\TeamTask\Automation\Daily\EB\20140508\Test1_QTP
Any suggestions are appreciated.
Solución 2
Otros consejos
If the specified folder exists, you can use the FileSystemObject
object instead of string manipulations:
strPath = "C:\TeamTask\Automation\Daily\EB\20140508\Test1_QTP"
Set fso = CreateObject("Scripting.FileSystemObject")
strName = fso.GetFolder(strPath).Name
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow