将文件夹中的所有文件复制到文档中
Copy all files from a folder it's content into a document
我想将 Documents
文件夹中的所有内容复制到 Documents
文件夹中的一个文件夹中。我编写的脚本可以复制文件夹,但不会复制这些文件夹中的文件。如何才能复制所有内容,包括文件图像或 Documents
文件夹中的任何内容。
$Files = Get-ChildItem
New-Item -Name Storage -ItemType Directory
Copy-Item $Files -Destination Storage
我不知道您是如何下定决心让您的脚本保持纯 PowerShell 的,但是一个简单的解决方案是只使用带有 /E
标志的 robocopy
工具来复制文件和目录在子目录中。
语法:robocopy source_dir destination_dir /E
我想将 Documents
文件夹中的所有内容复制到 Documents
文件夹中的一个文件夹中。我编写的脚本可以复制文件夹,但不会复制这些文件夹中的文件。如何才能复制所有内容,包括文件图像或 Documents
文件夹中的任何内容。
$Files = Get-ChildItem
New-Item -Name Storage -ItemType Directory
Copy-Item $Files -Destination Storage
我不知道您是如何下定决心让您的脚本保持纯 PowerShell 的,但是一个简单的解决方案是只使用带有 /E
标志的 robocopy
工具来复制文件和目录在子目录中。
语法:robocopy source_dir destination_dir /E