Powershell文件夹创建脚本

时间:2014-03-11 19:09:14

标签: powershell scripting

我需要将大约1000个文件夹放在子文件夹中。

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

Contracts
Leases
General

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

1 个答案:

答案 0 :(得分: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"
}