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. How can I do that?
Use the -exclude
switch of Get-ChildItem
.
$array = @("Thing1", "Thing2", "Thing3")
GCI -Path "Directory Name" -Exclude $array
And if you only want folders to show you can add the -Directory
switch
GCI -Path "Directory Name" -Exclude $array -Directory
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.