コマンド一覧
# カレントフォルダのみ
> Get-ChildItem * -File | Select-Object Name, FullName, LastWriteTime
# サブフォルダを含む
> Get-ChildItem * -Recurse -File | Select-Object Name, FullName, LastWriteTime
# フォルダを表示
> Get-ChildItem * -Recurse -File | Select-Object Name, DirectoryName, LastWriteTime
# 拡張子を指定
> Get-ChildItem * -Recurse -File -Include *.txt | Select-Object Name, DirectoryName, LastWriteTime
# ソート
> Get-ChildItem * -Recurse -File -Include *.txt | Select-Object Name, DirectoryName, LastWriteTime | Sort-Object -Property LastWriteTime, Name
# ソート(並び替え順序指定)
> Get-ChildItem * -Recurse -File -Include *.txt | Select-Object Name, DirectoryName, LastWriteTime | Sort-Object -Property @{ Expression = 'LastWriteTime'; Descending = $true }, Name
# ソート(表示列)
> Get-ChildItem * -Recurse -File -Include *.txt | Select-Object Name, DirectoryName, LastWriteTime | Sort-Object -Property @{ Expression = 'LastWriteTime'; Descending = $true }, Name | Format-Table -Property LastWriteTime, Name, DirectoryName
# CSV出力(Format-Tableは使えない)
> Get-ChildItem * -Recurse -File -Include *.txt | Select-Object Name, DirectoryName, LastWriteTime | Sort-Object -Property @{ Expression = 'LastWriteTime'; Descending = $true }, Name | Export-Csv -Encoding Default -Path C:\work\update-list.csv
参考