bug fixes!

This commit is contained in:
Erik Eckert 2024-07-05 16:38:19 -06:00
parent 1f2722fa8a
commit ded96f9524

View File

@ -8,7 +8,7 @@ This script will copy these files to Egnyte nightly. It will email helpdesk@mpe.
#> #>
$Local_Revit_Root = "R:\" $Local_Revit_Root = "\\mpe.ca\onprem\Revit\"
$OnPrem_DataCollector = "\\192.168.2.75\scache\Shared\" $OnPrem_DataCollector = "\\192.168.2.75\scache\Shared\"
$ErrorMessage = @() $ErrorMessage = @()
@ -66,7 +66,7 @@ function Send-Email {
} }
} }
$Local_Folder_List = get-childitem -path $Local_Revit_Root -Depth 0 -Directory $Local_Folder_List = get-childitem -path $Local_Revit_Root -Depth 0
foreach ($folder in $Local_Folder_List) { foreach ($folder in $Local_Folder_List) {
if ($folder.Name -eq "!TEMPLATE") { if ($folder.Name -eq "!TEMPLATE") {
@ -86,16 +86,16 @@ foreach ($folder in $Local_Folder_List) {
if ($OnPrem_DataCollector_up) { if ($OnPrem_DataCollector_up) {
# Validate Egnyte Path # Validate Egnyte Path
if (!(Test-Path $Egnyte_Path)) { if (!(Test-Path $OnPrem_DC_Path)) {
$Egnyte_Path_Valid = $false $Egnyte_Path_Valid = $false
$ErrorMessage += $FolderName + ": Path.txt error: Egnyte Path Doesn't Exist.<br />" $ErrorMessage += '`"' + $FolderName + "`": Path.txt error: Egnyte Path Doesn't Exist.<br />"
} }
else { else {
$Egnyte_Path_Valid = $true $Egnyte_Path_Valid = $true
} }
if (!($NumberofLines.Lines -eq 1)) { if (!($NumberofLines.Lines -eq 1)) {
$Egnyte_Path_Valid = $false $Egnyte_Path_Valid = $false
$ErrorMessage += $FolderName + ": Path.txt must specify only one path.<br />" $ErrorMessage += '`"' + $FolderName + "`": Path.txt must specify only one path.<br />"
} }
else { else {
@ -110,11 +110,12 @@ foreach ($folder in $Local_Folder_List) {
Write-Output "Copying $foldername to Egnyte" Write-Output "Copying $foldername to Egnyte"
# $Source_Path = $folder.FullName + "\*" # $Source_Path = $folder.FullName + "\*"
$Source_Path = $folder.FullName $Source_Path = $folder.FullName
robocopy.exe $Source_Path $OnPrem_DC_Path /MT:5 /w:5 /r:5 /XO /COPY:DAT $LogPath = $OnPrem_DC_Path + '\CopyLog.log'
robocopy.exe $Source_Path $OnPrem_DC_Path /MT:5 /w:5 /r:5 /XO /COPY:DAT /log:$LogPath
# Copy-Item $Source_Path $OnPrem_DC_Path -Force -Recurse # Copy-Item $Source_Path $OnPrem_DC_Path -Force -Recurse
} }
} else { } else {
$ErrorMessage += $FolderName + ": On Premise Path not Valid: $OnPrem_DC_Path. <font color='red'>Is the server up?</font><br />" $ErrorMessage += '`"' + $FolderName + "`": On Premise Path not Valid: `"$OnPrem_DC_Path`". <font color='red'>Is the server up?</font><br />"
} }