【问题标题】:Powershell folder creation scriptPowershell 文件夹创建脚本
【发布时间】:2014-03-11 19:09:13
【问题描述】:

我有大约 1000 个文件夹需要放入子文件夹。

在每个文件夹中,我需要创建这 3 个相同的文件夹

Contracts
Leases
General

有没有办法告诉 powershell 查看每个文件夹,然后放入那些子文件夹?

【问题讨论】:

    标签: powershell scripting


    【解决方案1】:

    你可以试试这样的:

    #Get your directories
    $folders = Get-ChildItem -Directory
    
    #Loop through folders and make the subdirectories
    $folders | ForEach-Object {
    mkdir "$($_.FullName)\Contracts"
    mkdir "$($_.FullName)\Leases"
    mkdir "$($_.FullName)\General"
    }
    

    【讨论】: