VB/.Net如果文件存在布尔值

编程入门 行业动态 更新时间:2024-10-27 00:30:53
本文介绍了VB/.Net如果文件存在布尔值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好, 我正在尝试创建一个函数,该函数将监视新文件的目录.文件名长度为20个字符,包括日期和随机性. 我尝试过类似的操作: DimstrLookupPath as string =("C:\ somefolder \ * _ 0513 *") 子ChcekForFile() 执行直到System.IO.File.Exists(strLookupPath) 但这不起作用-如果我不知道文件的全名,还有其他想法吗? TIA Edward

Hi All, I am trying to create a function that will watch a dir for a new file. The file names are 20 char long, including date, and randomness. I tried something like: DimstrLookupPath as string = ("C:\somefolder\*_0513*") sub ChcekForFile() Do until System.IO.File.Exists(strLookupPath) but this doesn''t work - any other thoughts if I don''t know the full name of the file? TIA Edward

推荐答案

您要FileSystemWatcher,但要注意: FileSystemWatcher-纯混沌(第1部分,共2部分) [ ^ ] FileSystemWatcher-纯混沌(第2部分,共2部分) [ ^ ] 它的反应方式取决于将文件放置在文件夹中的应用程序(请参见上面的第2部分). You want FileSystemWatcher, but beware: FileSystemWatcher - Pure Chaos (Part 1 of 2)[^] FileSystemWatcher - Pure Chaos (Part 2 of 2)[^] How it reacts depends on what application is placing the file in the folder (see the Part 2 article above).

您需要执行以下操作: You need to do something like: Dim files As String() = Directory.GetFiles("C:\somefolder\", "*_0513*")

这样,您可以使用通配符来执行搜索.

That way you can use wildcards to perform your searches.

更多推荐

VB/.Net如果文件存在布尔值

本文发布于:2023-11-05 15:45:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1561238.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   布尔值   VB   Net

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!