#https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/copy-item?view=powershell-7.1 echo 'start:' Get-Date -Format 'yyyy-MM-dd HH:mm:ss' if(Test-Path dist) { echo 'clear dist folder' Remove-Item ./dist/* -Recurse -Force } echo 'copy src to dist' #Copy-Item ./src/* ./dist -Recurse -Exclude @('src/linux-x64/publish/log','.gitignore','dev.cmd','docker-compose.override.yml','nginx.dev.conf') #Remove-Item ./dist/linux-x64/publish/log/* -recurse -force #Remove-Item ./dist/linux-x64/publish/data/* -recurse -force $source = (Get-Item -Path './src').FullName $dest = (Get-Item -Path './dist').FullName $exclude = @((Get-Item -Path './src/linux-x64/publish/log').FullName) Get-ChildItem -Path $source -Recurse -Exclude $exclude | where {$_.FullName -notin $exclude} | Copy-Item -Destination {Join-Path $dest $_.FullName.Substring($source.length)} echo 'copy project files to dist folder' Copy-Item ../projects/WebMVC/wwwroot ./dist/linux-x64/publish/apps/WebMVC/wwwroot -recurse Copy-Item ../projects/WebSPA/wwwroot ./dist/linux-x64/publish/apps/WebSPA/wwwroot -recurse Get-ChildItem -Path ./dist/linux-x64/publish