$sourcePath = \"\Tidal\Equities\EQDEVOPS\Python\"; $archivePath = \"\WEX\Archive\"; $sailpointPath = \"\WEX\"; $rawfilesPath = \"\WEX\Raw Files\"; $downloadedFile = Get-ChildItem $sourcePath | Where-Object { $_.Name -like \"WEX\" -and $_.Name -notlike \"*APP*\" }; if (Test-Path $sourcePath) { $files = Get-ChildItem $sourcePath | Where-Object { $_.Name -like \"-WEX_Sailpoint.xlsx\" };if ($files.Count -eq 0) { Write-Host \"No files exist in the source path.\"; exit }; $appFile = Get-ChildItem $sourcePath | Where-Object { $_.Name -eq \"WEX-APP.xlsx\" }; foreach ($file in $files) { $newFileName = $file.Name -replace \"^\d{4}-\d{2}-\d{2}-\", \"\" -replace \"_Sailpoint\", \"\"; $destinationFile = Join-Path $archivePath $file.Name; Copy-Item $file.FullName $destinationFile -Force; Copy-Item $file.FullName -Destination \"$sailpointPath\$newFileName\" -Force; if ($appFile) { Copy-Item $appFile.FullName -Destination \"$sailpointPath\$($appFile.Name)\" -Force }; if ($downloadedFile) { Copy-Item $downloadedFile.FullName -Destination \"$rawfilesPath\$($downloadedFile.Name)\" -Force }; Write-Host \"File: '$($file.Name)' successfully copied to Sailpoint file share.\" } } Consensys $sourcePath = \"\Tidal\Equities\EQDEVOPS\Python\"; $archivePath = \"\Consensys\Archive\"; $sailpointPath = \"\Consensys\"; $rawfilesPath = \"\Consensys\Raw Files\"; $downloadedFile = Get-ChildItem $sourcePath | Where-Object { $_.Name -like \"ConsensysUserList.csv\" -and $_.Name -notlike \"*APP*\" }; if (Test-Path $sourcePath) { $files = Get-ChildItem $sourcePath | Where-Object { $_.Name -like \"-Consensys_Sailpoint.xlsx\" };if ($files.Count -eq 0) { Write-Host \"No files exist in the source path.\"; exit }; $appFile = Get-ChildItem $sourcePath | Where-Object { $_.Name -eq \"Consensys-APP.xlsx\" }; foreach ($file in $files) { $newFileName = $file.Name -replace \"^\d{4}-\d{2}-\d{2}-\", \"\" -replace \"_Sailpoint\", \"\"; $destinationFile = Join-Path $archivePath $file.Name; Copy-Item $file.FullName $destinationFile -Force; Copy-Item $file.FullName -Destination \"$sailpointPath\$newFileName\" -Force; if ($appFile) { Copy-Item $appFile.FullName -Destination \"$sailpointPath\$($appFile.Name)\" -Force }; if ($downloadedFile) { Copy-Item $downloadedFile.FullName -Destination \"$rawfilesPath\$($downloadedFile.Name)\" -Force }; Write-Host \"File: '$($file.Name)' successfully copied to Sailpoint file share.\" } }