我必须在.csv格式的目录中创建所有最新文件或已访问文件的列表。但是我当前的脚本没有输出有用的文件。 (始终为0KB)
Get-ChildItem -Path X:\ -Directory -Recurse -Erroraction SilentlyContinue |
ForEach-Object { Get-ChildItem $_.Name -Recurse |
select Name,*time |
Sort-Object -Property LastaccessTime -Descending |
Select-Object -First 1 } |
Export-Csv -Path C:\...\testfile.csv
有人有更好的主意吗?
编辑:错误看起来像这样:
+ CategoryInfo : ReadError: (X:\xxx:String) [Get-ChildItem],DirectoryNotFoundException
+ FullyQualifiedErrorId : DirIOError,microsoft.PowerShell.Commands.getchildItemCommand