Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

Diamond72

Nobody can help me? Please
Diamond72

Ohhh ok, so it do not working with $transferOptions.FileMask ?
Do you have a Code Snippet for the other possibility please?
martin

Re: Upload Folders with FileMask <yesterday .NET

The time constraints do not work for directories:
https://winscp.net/eng/docs/file_mask#size_time
If you want to select directories based on their timestamps, you will have to code that in your PowerShell script.
Diamond72

Upload Folders with FileMask <yesterday .NET

Hi guys,

I am trying to write a automation for a SFTP Upload and need you help.
How can I realize to upload folders older than yesterday? I am scripting in PS with .NET Assembly. Here are my code snippet:

....
$transferOptions = New-Object WinSCP.TransferOptions
$transferOptions.TransferMode = [WinSCP.TransferMode]::Binary
$transferOptions.FileMask = "<1D"
$transferOptions.OverwriteMode.Overwrite
$transferResult = $session.PutFiles($source, $destinationSFTP, $False, $transferOptions)
....


I do not get a Fault in the Debugwindow and the Script put all Files on the SFTP
Whats wrong with this?

In addition I want to put the uploaded Folders in a Subfolder with Overwriting if the Folder has been in the Subfolder. To realizing this I am trying to do this but still getting the Error-Message that the file cannot be created if it already exists.

Move-Item -Path $Sourcelocation -Destination $subfolder -Force -Recurse

Do you have a idea?

Thanks for your help!