[英]How to get file name and compare in vb.net?
I am using the below code to get file name using FILE created event.我正在使用以下代码使用 FILE created 事件获取文件名。
WriteSilentLog("File Created: " & e.FullPath & " " & Now().ToString)
Dim sFileName As String
Dim FileExt As String
TestPath = e.FullPath '"\\server\E\Accpac Imports\production\reports\1234_maoingfhgh_90676904.pdf"
sFileName = Path.GetFileName(TestPath)
Filename.Text = sFileName
It works fine.它工作正常。 At the moment the all the file names are end with 'XXXXXXXX' eight digit.
目前所有的文件名都以'XXXXXXXX'八位数字结尾。 I am about to get another file name end with 'XXXXXXXX' random digit of 8 .
我即将获得另一个以 'XXXXXXXX' 随机数字结尾的文件名 8 。
My question is How do I differentiate the filename like below我的问题是如何区分如下文件名
' Pseudocode
IF filename Like last 8 digits that have changed in every file Then
open that pdf file that contain 8 random digits in last
Else If
Do somthing
End IF
Please Help请帮忙
If you want to find a file with a known 8 digits at the end;如果要查找末尾有已知 8 位数字的文件;
Dim known as integer = 12345678
Dim files = Directory.GetFiles("c:\temp\", "*_" & known & " .pdf", SearchOption.TopDirectoryOnly)
'Do something with the files array
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.