Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- write-host "Import all CSVs from $($csvlocation) and start multi-job copy for each CSV."
- $csvs = gci -Path $csvlocation *.csv
- foreach ($csv in $csvs) {
- $sourcecsv = import-csv $csv.FullName
- Start-Job -ArgumentList $sourcecsv -scriptblock {
- param($sourcecsv)
- foreach ($item in $sourcecsv){
- try {
- Test-Path $item.Destination
- } catch {
- write-host "$($item.Destination) not accessiable, moving on to next item."
- Continue
- }
- $date = (Get-Date).tostring("yyyyMMdd")
- $name = $item.FullName.Split("\\")[2]
- emcopy64 $item.FullName $item.Destination /s /o /c /r:3 /w:5 /q /log+:C:\evt\log\$name'_'$date.log
- }
- }
- }
- Return
- }
- CSV items look like this:
- Name FullName Destination
- dir1 C:\sharesource1\dir1 C:\Destination1\
- dir2 C:\sharesource1\dir2 C:\Destination1\
- dir3 C:\sharesource1\dir3 C:\Destination1\
- dir4 C:\sharesource2\dir4 C:\Destination2\
- dir5 C:\sharesource3\dir5 C:\Destination3\
- dir6 C:\sharesource3\dir6 C:\Destination3\
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement