Copy-Item を使用して、存在しない場合に作成する必要がある宛先ディレクトリに、ソース ディレクトリからすべてのファイルをコピーしようとしています。
最初の試行: Copy-Item 'C:\sourcePath\reports' 'C:\destPath\reports' -Force -Recurse
すべては順調です。ただし、コマンドを再度実行すると、C:\sourcePath\reports のコンテンツをコピーする代わりに、powershell が C:\destPath\reports の下に追加のレポート サブフォルダーを作成します。C:\destPath\reports\reports になります。
その他の試み:
Copy-Item 'C:\sourcePath\reports*' 'C:\destPath\reports' -Force -Recurse これは宛先パス C:\destPath\reports を作成しません
Copy-Item 'C:\sourcePath\reports**' 'C:\destPath\reports' -Force -Recurse これは、フォルダーではなくレポート ファイルにコンテンツをコピーします。
これを機能させる方法を知っている人はいますか?これ