- С расширениями PowerShell Community (pscx) поставляется
Show-Tree
командлет - , который имеет параметр
-ShowProperty
, который показывает все свойства - этиможно уменьшить с помощью параметра
-ExcludeProperty
> Show-Tree c:\test -ShowLeaf -ShowProperty -Excludeproperty $Exclude
C:\test
|--Property: LastWriteTime = 05/12/2018 21:40:57
|--2018
| |--Property: LastWriteTime = 04/10/2018 19:00:47
| \--04
| |--Property: LastWriteTime = 04/10/2018 19:00:47
| \--10
| \--Property: LastWriteTime = 04/10/2018 19:00:47
Для предварительного подтверждения этого вывода (LastWriteTime добавляется в той же строке)
этот скрипт:
## Q:\Test\2018\05\21\SO_50469606.ps1
$Exclude = ("Attributes","BaseName","CreationTime","CreationTimeUtc","Exists",
"Extension","FullName","LastAccessTime","LastAccessTimeUtc",
"LastWriteTimeUtc","LinkType","Mode","Parent","ReparsePoint","Root",
"Target","Directory","DirectoryName","IsReadOnly","Length","VersionInfo")
$BaseDir = 'c:\test'
(Show-Tree $BaseDir -ShowLeaf -ShowProperty -ExcludeProperty $Exclude -IndentSize 4|
out-string) -replace '([a-z]?:?[\\\|\- ]+.*?)\r?\n.*Property: LastWriteTime = ([0-9\/\.: \-]+)','$2 $1'
возвращает этот пример вывода:
05/12/2018 21:40:57 C:\test
04/10/2018 19:00:47 |---2018
04/10/2018 19:00:47 | \---04
04/10/2018 19:00:47 | \---10
05/17/2018 16:01:17 |---folder1
05/17/2018 16:01:17 | \---blah.txt
04/27/2018 23:40:27 |---folder2
04/27/2018 23:40:27 |---folder3
03/29/2018 15:37:15 |---subdir0
03/29/2018 15:37:15 |---subdir1
03/29/2018 15:41:55 |---subdir2
03/29/2018 15:41:34 | \---20180329154134,19.txt
03/29/2018 15:37:15 |---subdir3
03/29/2018 15:42:11 \---subdir4
03/29/2018 15:42:05 |---20180329154205,27.txt
03/29/2018 15:42:11 \---20180329154211,87.txt