[英]Powershell Get-ChildItem command
我使用Windows命令行导出目录中所有文件的列表,包括完整路径。 命令是:
DIR /b/s/n/a:-d/o:>"C:\Users\user\Desktop\file_list.txt"
/b to list only files and folder with no additional information;
/s to list all files within the subfolders;
/n to list long names (here is my problem, it still list max. 255 char);
/a:-d to not list directories without files;
/o to sort files.
我想在PowerShell上运行类似的命令,但要列出超过255个字符的文件。
有人可以帮忙吗?
-recurse
开关一起使用可从特定路径检索所有文件和文件夹。 $_.PSIsContainer
等于true,文件计数大于零)。 FullName
的项目。 例:
Get-ChildItem C:\Users\ -recurse |
Where-Object {(($_.PSIsContainer -eq $false) -or (($_.PSIsContainer -eq $true) -and ($_.GetFiles().Count -gt 0)))} |
Select-Object FullName |
Out-File 'C:\Users\user\Desktop\file_list.txt'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.