Windows:如何以大小和最后访问日期递归列出文件? [英] Windows : How to list files recursively with size and last access date?
问题描述
我需要一种简单的方法来创建某个文件夹中所有文件的列表。 (递归)
I need a simple way to create a list of all files in a certain folder. (recursively)
每个文件必须在一行中。我还需要在同一行中用特殊字符分隔的文件大小和最后一次访问日期。
Each file must be in a single line. I also need the file size and the last access date in the same line, separated by a special character.
输出(textfile)应如下所示:
The output (textfile) should look like this:
c:\folder\file1.txt|400|2012-11-12 15:23:08
c:\folder\file2.txt|200|2012-11-12 15:23:08
c:\folder\file3.txt|100|2012-11-12 15:23:08
c:\folder\sub folder\file4.txt|500|2012-11-12 15:23:08
'Dir'似乎不是一个选择,因为德语特殊字符被弄乱了。 (öäüß)
'Dir' seems not to be an option, because the German Special characters get messed up that way. (öäüß)
Powershell很好地处理了特殊字符,但是我不能这样做,以致于一个文件的信息结束在一行:
Powershell handles the special characters well, but I couldn't make it so that the information for one file ends up in a single line:
get-childitem D:\temp -rec | where {!$_.PSIsContainer} | foreach-object -process {$_.FullName, $_.LastWriteTime, $_.Length}
推荐答案
试试这个:
get-childitem D:\temp -rec | where {!$_.PSIsContainer} |
select-object FullName, LastWriteTime, Length | export-csv -notypeinformation -delimiter '|' -path file.csv
这篇关于Windows:如何以大小和最后访问日期递归列出文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!