我想遍历一个目录并删除 Uipath 中所有早于 x 的文件。我的问题是我不知道如何查看可能在其中的另一个文件夹。
2 回答
1
以下是枚举文件夹和所有潜在子文件夹中每个文件的方法:Directory.EnumerateFiles(root, "*.*", SearchOption.AllDirectories)
.
然后,您可以使用File.GetAttributes(file)
返回一个FileAttributes
对象,该对象将公开有关文件创建日期的详细信息,例如(更多信息here)。
于 2018-10-24T16:56:15.180 回答
0
使用 UiPath.Core.Activities.InvokePowerShell
命令文本(示例):
("Remove-Item -Path " + Path.Combine([YOURPATH], "*.*") + " -Force -Recurse")
这将递归删除目录中的所有文件。
于 2018-10-26T06:54:17.443 回答