有人可以告诉我为什么get-childitem会两次返回同一个文件夹吗?
代码
$StartTime = (get-date)
new-item "D:\Shares\Vorsorge\000_Musterkunde\Folder" -type directory
Get-ChildItem "D:\Shares\Vorsorge\000_Musterkunde" -Recurse | where-object {$_.CreationTime -gt $starttime}
输出
Verzeichnis: D:\Shares\Vorsorge\000_Musterkunde
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 29.01.2014 16:45 Folder
d---- 29.01.2014 16:45 Folder
答案 0 :(得分:3)
Get-Childitem仅返回1.另一个由New-Item输出。试试这个,看看你是否只得到一个:
$StartTime = (get-date)
new-item "D:\Shares\Vorsorge\000_Musterkunde\Folder" -type directory > $null
Get-ChildItem "D:\Shares\Vorsorge\000_Musterkunde" -Recurse | where-object {$_.CreationTime -gt $starttime}