Multiple file mask help

Advertisement

RodneyAllen
Joined:
Posts:
4
Location:
UK

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.
Thanks

# Connect
$session.Open($sessionOptions)
$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".

Reply with quote

Advertisement

RodneyAllen
Joined:
Posts:
4
Location:
UK

hello Martin

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

Thanks

> 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]

Reply with quote

Advertisement

RodneyAllen
Joined:
Posts:
4
Location:
UK

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?

Thanks
> 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

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,852
Location:
Prague, Czechia

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.

Reply with quote

Guest

Hello Martin
I'm arranging the upgrade and in meantime please find the last session log attached
Thank you again for your help
  • OXRIO_2024-04-25.txt (166.63 KB, Private file)
Description: redacted session log attached

Reply with quote

Advertisement

You can post new topics in this forum