我设法列出了我在过去5分钟内修改过的所有文件,但我只需要修改后的txt文件 . 我怎么能得到它?
这是我的代码:
Get-ChildItem -Recurse| where-object{$_.LastWriteTime -gt (Get-Date).AddMinutes(-5)}
我知道我应该使用 -match ,但我不知道在哪里放以及如何正确使用它 .
-match
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-childitem?view=powershell-6
有一个示例的部分向下有 -Path *.txt (如果你想要更具体的例子,它也有一个 -Include *.txt -Exclude A* ) - 尝试那些
-Path *.txt
-Include *.txt -Exclude A*
由于这些东西是 Get-ChildItem 的选项,它们应该在 -Recurse 之前/之后,即在管道之前 |
Get-ChildItem
-Recurse
|
1 回答
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-childitem?view=powershell-6
有一个示例的部分向下有
-Path *.txt
(如果你想要更具体的例子,它也有一个-Include *.txt -Exclude A*
) - 尝试那些由于这些东西是
Get-ChildItem
的选项,它们应该在-Recurse
之前/之后,即在管道之前|