[英]Store the name but not the path of all folders in a specified folder to a list?
[英]powershell Generate a list with all others folders name
假设我有一个文件夹名称像这样$list=@("folder1","folder2","folder3")
的数组,我想生成第二个列表,其中包含该路径中的所有其他文件夹,但不包括我的列表。 我怎样才能做到这一点?
使用Get-ChildItem
的-exclude
开关。
$array = @("Thing1", "Thing2", "Thing3")
GCI -Path "Directory Name" -Exclude $array
如果您只想显示文件夹,您可以添加-Directory
开关
GCI -Path "Directory Name" -Exclude $array -Directory
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.