简体   繁体   English

powershell 生成包含所有其他文件夹名称的列表

[英]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.

相关问题 将名称但不是指定文件夹中所有文件夹的路径存储到列表中? - Store the name but not the path of all folders in a specified folder to a list? Powershell按升序获取过去4个月内修改的所有文件夹和文件的列表 - Powershell get list of all folders and files modified in the last 4 months in ascending order 以特定模式导出文件夹列表 PowerShell - export folders list in specific pattern PowerShell 批处理:创建文件夹列表,然后将多个文件/文件夹复制到所有文件夹中 - Batch: Create a list of folders and then copy multiple files/folders into all of them Powershell 以表格形式获取子文件夹列表和每个文件的数量 - Powershell get list of sub folders and number of files in each in a table format 生成列表列表的所有替换 - Generate All Replacements for List of Lists 如何使用Powershell获取文件夹中所有文件夹名称而不是子文件夹中文件/子文件夹的.txt文件? - How to get a .txt file of all folders names inside a folder but not the files/subfolders inside the child folders using powershell? 迭代地将一个元素与 Python 列表中的所有其他元素进行比较 - Iteratively compare one element to all others in a Python list 从列表中排除一个项目(按索引),并取消所有其他项目 - Excluding one item from list (by Index), and take all others 如何检查列表中是否只有一个 position 为空白,其他所有不是 - How to check if only one position in a list is blank and all others are not
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM