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