Re: Corruption occurred - what to do with debug log file?
How much of the log file do you need to take a look, for me-- just the info related to the specific corrupted file?
That and the log header. Thanks.
Before posting, please read how to report bug or request support effectively.
Bug reports without an attached log file are usually useless.
How much of the log file do you need to take a look, for me-- just the info related to the specific corrupted file?
Can you post a log file for that?
Session.SessionLogPath
to.
I am back, after having temporarily given up on WinSCP because the data was corrupting on transfer. How do I contact you to fix my forum login? The system says that someone is using my user name and my email address -- but not together.
Session.DebugLogLevel = 2
. Once you reproduce the problem, please attach a log file showing upload of the corrupted file. And provide an original of the corrupted file as well as the corrupted file.
I am back, after having temporarily given up on WinSCP because the data was corrupting on transfer.
*-****","NuXXnt","PaXXXcia","E","","Ms","","12/31/1946","Female","09/05/2015","07/30/2007","01/01/3000"
"9910115","***-**-****","BrXXn","CXXXl","ElXXXtt","","Ms","","09/27/1946","Female","09/05/2015","08/28/1978","01/01/3000"
cls
$UserName = "myemail@address.com"
$Password = Get-Content 'C:\users\sisdbuser\documents\CloudSFTPSecurePass.txt' | ConvertTo-SecureString
$cred = New-Object Management.Automation.PSCredential $UserName, $Password
$localDir = "C:\Users\sisdbuser\Documents\EmployeeData\"
$logfileDir = "C:\users\sisdbuser\documents\logs\"
$logfileName = "$(get-date -f yyyyMMdd_HHmm)_FROMCloud_StaffData.log"
$remoteDir = "/Prod/WIM_OUT/Tech/"
$FileFilter = "CCSD*.CSV"
$emailBody = "see \\AppDev2012\c$\users\sisdbuser\Documents\EmployeeData\`r`n"
$msg = new-object Net.Mail.MailMessage
$msg.From = 'NoReply@address.com'
$msg.To.Add("myemail@address.com")
$SMTPServer='webmail.@address.com'; #'192.106.2.53';
$SMTPClient=New-Object Net.Mail.SmtpClient($SmtpServer,25);
Function LogWrite
{
Param ([string]$logstring)
Add-content $logfileDir$logfileName -value $logstring
}
add-content $logfileDir$logfileName -value "started $(get-date)" -force
Add-Type -Path (Join-Path "C:\Program Files (x86)\winscp" "WinSCPnet.dll")
try
{
$sessionOptions = New-Object WinSCP.SessionOptions -Property @{
Protocol = [WinSCP.Protocol]::Sftp
HostName = "xfer.Cloud.net"
UserName = $cred.UserName
Password = $cred.GetNetworkCredential().Password
SshHostKeyFingerprint = "ssh-rsa 2048 fingerprint:here"
}
$session = New-Object WinSCP.Session
$session.Open($sessionOptions)
$transferOptions = New-Object WinSCP.TransferOptions
$transferOptions.TransferMode = [WinSCP.TransferMode]::ASCII
$transferResult = $session.synchronizeDirectories([WinSCP.SynchronizationMode]::Local,$LocalDir,$remoteDir,$False,$False)
$transferResult.Check()
if ($TransferResult.Downloads.count -ge 1)
{
foreach ($transfer in $TransferResult.downloads) # $getfiles)
{
$TransferredFilename = $transfer.FileName.replace($remotedir,'').padright(40,' ')
$FileStamp = $session.getfileinfo($transfer.filename).lastwritetime #$transfer.lastwritetime
LogWrite "Download of $TransferredFilename dated $FileStamp succeeded" #`r`n" #| out-file -append $logfileDir$logfileName
$emailBody = $emailBody + "{0,-40} {1,-25}" -f "Download of $TransferredFilename","dated $FileStamp succeeded`r`n"
$msg.Subject="Staff Data file(s) found for downloading from Cloud [see body of message for details]"
$msg.IsBodyHtml = $False
$msg.Body = $emailBody
}
}
else
{
LogWrite "No changed Staff Data files found in on Cloud Cloud to download [End of message]"
$msg.Subject="No changed Staff Data files found in on Cloud Cloud to download [End of message]"
exit 0}
}
finally
{
if ($session.length -ge 0)
{
$session.dispose()
if ($msg.Subject -gt "")
{
$SMTPClient.Send($msg);
}
}
# clear session variables
$sessionoptions=""
$session=""
$transferOptions=""
$localDir=""
$FileFilter=""
$File=""
$transferResult=""
$logfile=""
$Transfer=""
$TransferredFilename=""
$msg=""
$att=""
$FileStamp=""
$remoteDir=""
$logfileDir=""
$logfileName=""
$localcopyDir=""
$emailBody=""
exit 0
}
catch [Exception]
{
Write-Host ("Error: {0}" -f $_.Exception.Message)
# clear session variables
$sessionoptions=""
$session=""
$transferOptions=""
$localDir=""
$FileFilter=""
$File=""
$transferResult=""
$logfile=""
$Transfer=""
$TransferredFilename=""
$msg=""
$att=""
$FileStamp=""
$remoteDir=""
$logfileDir=""
$logfileName=""
$localcopyDir=""
$emailBody=""
exit 1
}
because I cannot spend any more time on bad transfers
How exactly are you doing that?
If you re-download the same file again immediately, do you get the same corruption? Or is the problem temporary?
Are you sure you can reproduce the problem with a binary mode? Can you post a log file for that?
I can look at these files on the server, prior to transfer