Post a reply

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)


Topic review


Sorry, I didn't realise that timestamps of the local excluded files are not logged.

Can you add lls D:\ftp\Oxleas command before the put?

Though, if you want transfer new files (those from the last 24 hours), you want >1D, not <1D.

Hello Martin
I'm arranging the upgrade and in meantime please find the last session log attached
Thank you again for your help

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, use /log=C:\path\to\winscp.log command-line argument. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Many thanks again for your time Martin
unfortunately now everything was blocked and nothing uploaded !
My effort has been that I couldn't get the syntax but really appreciate your help :). Do you need any details further or help please?

> 2024-04-23 07:15:08.190 Script: put -delete -nopermissions -preservetime -transfer="binary" -filemask="<1D | *_Merges_*" -- ...

but files less than day excluded not included
. 2024-04-23 07:15:08.408 File "D:\ftp\Oxleas\RiO_Admissions_OXLEAS_20240422211802.CSV" excluded from transfer

* 2024-04-23 07:15:08.408 (ESkipFile)
. 2024-04-23 07:15:08.408 File "D:\ftp\Oxleas

hello Martin

appreciate the help but unfortunately now nothing is skipped, old or Merge files. Can you help please?


> 2024-04-19 07:15:05.134 Script: put -delete -nopermissions -preservetime -transfer="binary" -filemask="|*_Merges_*<1D" -- 

. 2024-04-19 07:15:39.681 Transfer done: 'D:\ftp\Oxleas\RiO_Demographics_OXLEAS_20240414211802.CSV' => '/oxleasRIO/RiO_Demographics_OXLEAS_20240414211802.CSV' [11753]
. 2024-04-19 07:15:40.009 Transfer done: 'D:\ftp\Oxleas\RiO_Merges_OXLEAS_20240203211801.CSV' => '/oxleasRIO/RiO_Merges_OXLEAS_20240203211801.CSV' [32]

would they way i had it explain the intermittent behaviour? i will test overnight and get back with results

Re: Multiple file mask help

There should be no semicolon between the two conditions, if you want them to work at the same time:
$transferOptions.FileMask = "|*_Merges_*<1D";


Multiple file mask help

Hello all
I am trying to include files less than a day old and exclude files that contain Merge using the following WinSCP PowerShell script. Is there something I can rewrite to have both masks work every time please? Let me know if you need any further info.

# Connect
$emailBody += "`n[$(get-date -f G)] Session opened"
# Transfer files
$transferOptions = New-Object WinSCP.TransferOptions
$transferOptions.FileMask = "|*_Merges_*;<1D";

In the log files in test using a handpicked selection of files this seems to work, as follows
. 2024-04-16 10:04:05.876 Transfer done: 'D:\ftp\Oxleas\RiO_Admissions_OXLEAS_20240415211802.CSV' => '/oxleasRIO/RiO_Admissions_OXLEAS_20240415211802.CSV' [11512] Less than day old ok
. 2024-04-16 10:04:05.876 Deleting successfully uploaded source file "D:\ftp\Oxleas\RiO_Admissions_OXLEAS_20240415211802.CSV".
. 2024-04-16 10:04:05.891 File "D:\ftp\Oxleas\RiO_Alerts_OXLEAS_20240413211801.CSV" excluded from transfer
* 2024-04-16 10:04:05.891 (ESkipFile) older than a day skipped
. 2024-04-16 10:04:05.891 File "D:\ftp\Oxleas\RiO_Alerts_OXLEAS_20240414211802.CSV" excluded from transfer
* 2024-04-16 10:04:05.891 (ESkipFile) older than a day skipped
. 2024-04-16 10:04:05.891 File "D:\ftp\Oxleas\RiO_Merges_OXLEAS_20240409211801.CSV" excluded from transfer
* 2024-04-16 10:04:05.891 (ESkipFile) filename contains merge skipped

However in live using the same script on the same server with live data feed Merges are skipped but old files are not
. 2024-04-17 07:15:51.658 File "D:\ftp\Oxleas\RiO_Merges_OXLEAS_20240416211801.CSV" excluded from transfer
* 2024-04-17 07:15:51.658 (ESkipFile) merge skipped
. 2024-04-17 07:15:51.658 File: 'D:\ftp\Oxleas\RiO_MHCareCoordinator_OXLEAS_20240203211801.CSV' [2024-04-17T06:04:34.399Z] [32]
. 2024-04-17 07:15:51.658 Copying "D:\ftp\Oxleas\RiO_MHCareCoordinator_OXLEAS_20240203211801.CSV" to remote directory started.
< 2024-04-17 07:15:51.674 Status code: 0
. 2024-04-17 07:15:51.674 Transfer done: 'D:\ftp\Oxleas\RiO_MHCareCoordinator_OXLEAS_20240203211801.CSV' => '/oxleasRIO/RiO_MHCareCoordinator_OXLEAS_20240203211801.CSV' [32] unwanted old file copied
. 2024-04-17 07:15:51.674 Deleting successfully uploaded source file "D:\ftp\Oxleas\RiO_MHCareCoordinator_OXLEAS_20240203211801.CSV".