Topic "Transfering files using get command"

Author Message
NU

Guest


Please help.

I'm running a script every 15mins to pull down files from another server. What I'm finding is WinSCP is not pulling down all the files, it seems that the seconds are not displayed in the remote panel. For instance today a file was created 11.53am and 59 seconds, WinSCP ran at 11.53am and 56 seconds, then ran again at 12.08am and 56 seconds. The problem is it only sees the remote file as 11.53 as below and ignores copying the file.

2017-10-17 12:08:56.164 10-17-17 11:53AM 1966 SHIPMENT_ORD_20171017125346_008758.csv

Is there a way to get WinSCP to look at the seconds of the file properties in the remote window and use this in the script?

The script i'm using is:

# FTP credentials and Server Login
open ftp://***:*********@*.*.*.3/

# Local drive selection
lcd F:\AS2\LIVE\LIVE\SOURCE

# Pull files that have arrived in the last 15mins
get /Receive/ -filemask="SHIPMENT_ORD_*.csv>=15N"

exit

Many thanks
Advertisements
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 27059
Location: Prague, Czechia
Do you mean that you believe that despite WinSCP displaying timestamps with seconds in GUI, it uses minutes only in scripting? Why do you think so? Can you show us a log file proving that?

Anyway, even if with seconds being used, your approach can never be reliable. You better use synchronization. Or remember an exact timestamp of the latest file downloaded in each run. And use that as a threashold for the consecutive run.
NU

Guest


I've attached an image of the gui, in the /sent tab on the right hand side, the changed column only shows the files in hh:MM.

I've attached a log file, the file in question is SHIPMENT_ORD_20171017125346_008758.csv, you can see the copy routine runs at 11:53:55.176 and completes at 11:53:55.304. The file gets added to the folder with the timestamp of 11:53:59, when the copy routine runs 15mins later at 12:08:56.120 it excludes the file. In the log file the timestamp is 11:53AM only.

Thanks
Logfile.txt (100.43 KB) [Download]

Description: (none)

WinSCP.JPG (240.54 KB) [Download]

Description: (none)

martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 27059
Location: Prague, Czechia
OK, so the server does not provide the seconds. Then, there's nothing on WinSCP side that can get fixed.
I do not think that you can make Windows IIS FTP server provide the seconds.
As I wrote, you should use a different technique. Your approach is not reliable, even if the server had provided the seconds.
I can prepare some example in next few days.
For now, see https://winscp.net/eng/docs/faq_script_modified_files
NU

Guest


Thanks Martin.

The problem I have is I don't want the directories to sync. The reason being is the remote directory imports the files into an application, if I sync the directories then it will error because the remote directory moves the file to a different location and the synchronization will sync the same file again.
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 27059
Location: Prague, Czechia
I understand that.
That's why I suggested:
Quote:
Or remember an exact timestamp of the latest file downloaded in each run. And use that as a threashold for the consecutive run.


I've added an example of implementation:
https://winscp.net/eng/docs/faq_script_modified_files#last_timestamp
Advertisements

You can post new topics in this forum

Search

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!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License