遍历 Uipath 中的目录
Go over directories in Uipath
我想在 Uipath 中遍历一个目录并删除所有早于 x 的文件。我的问题是我不知道如何查看可能在里面的另一个文件夹。
以下是枚举文件夹中的每个文件和所有潜在子文件夹的方法:Directory.EnumerateFiles(root, "*.*", SearchOption.AllDirectories)
。
然后您可以使用 File.GetAttributes(file)
到 return 一个 FileAttributes
对象,该对象将显示有关文件创建日期的详细信息,例如(更多信息 here ).
使用UiPath.Core.Activities.InvokePowerShell
命令文本(样本):
("Remove-Item -Path " + Path.Combine([YOURPATH], "*.*") + " -Force -Recurse")
这将递归删除目录中的所有文件。
我想在 Uipath 中遍历一个目录并删除所有早于 x 的文件。我的问题是我不知道如何查看可能在里面的另一个文件夹。
以下是枚举文件夹中的每个文件和所有潜在子文件夹的方法:Directory.EnumerateFiles(root, "*.*", SearchOption.AllDirectories)
。
然后您可以使用 File.GetAttributes(file)
到 return 一个 FileAttributes
对象,该对象将显示有关文件创建日期的详细信息,例如(更多信息 here ).
使用UiPath.Core.Activities.InvokePowerShell
命令文本(样本):
("Remove-Item -Path " + Path.Combine([YOURPATH], "*.*") + " -Force -Recurse")
这将递归删除目录中的所有文件。