help with -nopreservetime
I am trying to add -nopreservetime to this code. I am not sure where or how to add it, I have tried different things to no result. Any help would be greatly appreciated.
[code] # Setup session options
$sessionOptions = New-Object WinSCP.SessionOptions
$sessionOptions.Protocol = [WinSCP.Protocol]::Sftp
$sessionOptions.HostName = "#######.com"
$sessionOptions.UserName = "#####"
$sessionOptions.Password = "#####"
$sessionOptions.SshHostKeyFingerprint = "#####"
$sessionOptions.Timeout = "##"
$TransferOptions.PreserveTimestamp = $false
$session = New-Object WinSCP.Session
$Session.SessionLogPath = "C:\Users\user1\Desktop\Winscp\TEST\sessionlog.txt"
$Session.debugLogPath = "C:\Users\user1\Desktop\Winscp\TEST\debugsessionlog"+$date+".txt"
try
{
Write-Host $date,("Connecting to FTP site.")
# Connect
$session.Open($sessionOptions)
Write-Host $date,("Connected to FTP site.")
$transferOptions = New-Object WinSCP.TransferOptions
$transferOptions.TransferMode = [WinSCP.TransferMode]::Binary
# Upload files, collect results
$transferResult = $session.PutFiles("$localPath", "$remotePath", $False, $transferOptions)[/code]
this is normally :
$transferResult = $session.PutFiles($localPath, $remotePath)
I am just trying to diable preserve timestamp. I have it off in the gui but it isnt working in the powershell_ise.exe
the above code returns this in the log:
> 2015-07-20 08:52:44.635 Script: put -nopermissions -preservetime -transfer="binary" -- "C:\Users\user\Desktop\Winscp\######\##\####\*.pdf" "/OUTGOING/TEST#####/##/"
[code] # Setup session options
$sessionOptions = New-Object WinSCP.SessionOptions
$sessionOptions.Protocol = [WinSCP.Protocol]::Sftp
$sessionOptions.HostName = "#######.com"
$sessionOptions.UserName = "#####"
$sessionOptions.Password = "#####"
$sessionOptions.SshHostKeyFingerprint = "#####"
$sessionOptions.Timeout = "##"
$TransferOptions.PreserveTimestamp = $false
$session = New-Object WinSCP.Session
$Session.SessionLogPath = "C:\Users\user1\Desktop\Winscp\TEST\sessionlog.txt"
$Session.debugLogPath = "C:\Users\user1\Desktop\Winscp\TEST\debugsessionlog"+$date+".txt"
try
{
Write-Host $date,("Connecting to FTP site.")
# Connect
$session.Open($sessionOptions)
Write-Host $date,("Connected to FTP site.")
$transferOptions = New-Object WinSCP.TransferOptions
$transferOptions.TransferMode = [WinSCP.TransferMode]::Binary
# Upload files, collect results
$transferResult = $session.PutFiles("$localPath", "$remotePath", $False, $transferOptions)[/code]
this is normally :
$transferResult = $session.PutFiles($localPath, $remotePath)
I am just trying to diable preserve timestamp. I have it off in the gui but it isnt working in the powershell_ise.exe
the above code returns this in the log:
> 2015-07-20 08:52:44.635 Script: put -nopermissions -preservetime -transfer="binary" -- "C:\Users\user\Desktop\Winscp\######\##\####\*.pdf" "/OUTGOING/TEST#####/##/"