ソースフォルダーからファイルのサブセットをコピーしてターゲットフォルダーに配置するPowerShellスクリプトを作成しようとしています。「アイテムのコピー」と「アイテムの削除」で半日遊んでいますが、希望する結果や一貫した結果が得られません。
たとえば、次のコマンドレットを複数回実行すると、ファイルは別の場所に配置されますか?!?!:
copy-item -Path $sourcePath -Destination $destinationPath -Include *.dll -Container -Force -Recurse
私は考えられるオプションとコマンドのすべての組み合わせを試してきましたが、適切な解決策を見つけることができません。私は非定型のことは何もしていないと確信しているので、誰かが私の痛みを和らげ、使用する適切な構文を提供してくれることを望んでいます。
ソースフォルダには、さまざまな拡張子を持つ多数のファイルが含まれます。たとえば、次のすべてが可能です。
- .dll
- .dll.config
- 。EXE
- .exe.config
- .lastcodeanalysisissucceeded
- .pdb
- .Test.dll
- .vshost.exe
- .xml
- 等々
スクリプトは、.test.dllおよび.vshost.exeファイルを除いて、.exe、.dll、および.exe.configファイルのみをコピーする必要があります。ターゲットフォルダがまだ存在しない場合は、それらを作成するためのスクリプトも必要です。
私を動かす助けがあればありがたいです。