我有问题要用Chilkat.FileAccess.FileDelete删除所有文件使用。,日志上写着,如何处理这个问题,谢谢!
ChilkatLog: FileDelete: ChilkatVersion: 9.5.0.75 WindowsError:文件名、目录名或卷标签语法不正确。failedToDeleteFilepath: C:\TMP\untar001*.* -文件删除--ChilkatLog
发布于 2018-11-24 17:56:00
您将通配符传递给不接受通配符的FileAccess.FileDelete。不幸的是,Chilkat API没有提供枚举目录中文件的方法,因此,如果您想坚持使用Chilkat API,就必须删除整个目录:
fa.DirDelete("C:\\TMP");否则,使用标准.NET:
foreach (string file in Directory.EnumerateFiles(
"C:\\TMP",
"untar001*.*" ,
SearchOption.AllDirectories)
)
{
fa.FileDelete(file);
}发布于 2018-11-27 00:20:38
可以使用Chilkat枚举目录中的文件,也可以在整个目录树中枚举文件。
参见此处的DirTree类:http://www.chilkatsoft.com/refdoc/csDirTreeRef.html
这里有一个例子:iterate.asp
https://stackoverflow.com/questions/53460519
复制相似问题