Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
in CompleteFTP by (48.3k points)
A user recently had a problem which required diagnostics leading up to a server restart.

1 Answer

0 votes
by (48.3k points)
Best answer

We provided him with a solution that automatically backed up the log files when the server started up.

  1. Open CompleteFTP Manager
  2. Select the Events panel
  3. Click Add
  4. Enter Back up logs in the Name field
  5. Click Choose
  6. Select Server start
  7. Select Powershell script
  8. Copy the script at the end of this comment into the Script field
  9. Click Apply changes


# Backs up all Diagnostics.log files in a timestamped zip file

$today = Get-Date -Format "yyyy-MM-dd"
$logFolder = "C:\ProgramData\Enterprise Distributed Technologies\Complete FTP\Logs\"
$backupFolder = "$logFolder\Backup-$today"
$zipPath = "$logFolder\Backup-$today.zip"

# Delete backup folder if it exists
If (test-path $backupFolder)
    Remove-Item -Path $backupFolder -Force -Recurse

# Create a new backup folder
New-Item -ItemType Directory -Force -Path $backupFolder

# Remove zip file if it exists
If (test-path $zipPath)
    Remove-Item -Path $zipPath -Force

# Copy Diagnostic log files into backup folder (since we can't zip coz of file-lock)
Copy-Item -Path "$($logFolder)\Diagnostics.*" -Destination $backupFolder

# Create the zip
Compress-Archive -Path $backupFolder -DestinationPath $zipPath

# Delete the backup folder
Remove-Item -Path $backupFolder -Force -Recurse