Topic "Help with a script mask Change Date > 7 days ago, ignore filename case and character change"

Author Message


I am trying to create a file transfer with some peculiar rules and can't seem to picture how to do it.

In the remote directory I have files named J_YYYYMMDDHHNN_PARTA where YYYY=year, MM=Month, DD=day,HH=Hour, and NN=Minutes.
In the local directory, the file names are:J_YYYYMMDDHHNN.PartA where YYYY=year, MM=Month, DD=day,HH=Hour, and NN=Minutes.

The remote directory has files back as far as 2013. So I only want to look at files that are 7 days old or younger (today-7 days).

I want to ignore upper case/lower case differences.

And I need to ignore the character change where the second underscore ('_') becomes a period (dot, '.').

Since I don't know when the file will show up on the remote, I need to run the job every few minutes from 3:00am to 5:00am.
That's why I need to not download files that have already been downloaded.

The problem is that when the file is first downloaded, it triggers a local process that changes the second underscore character (and for some reason the case of the characters in 'PART') to a dot.

The dot is the only way the local process has of knowing that it has already processed the file.

Is there a way to do this in a script?

Thank you for your help.

[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26331
Location: Prague, Czechia
You hardly do with with simple WinSCP scripting.

Though, it should be rather easy to implement in PowerShell script with a use of WinSCP .NET assembly.

You can post new topics in this forum

Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License