Transfering files using get command

Advertisement

NU
Guest

Transfering files using get command

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

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,532
Location:
Prague, Czechia

Re: Transfering files using get command

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.

Reply with quote

NU
Guest

Re: Transfering files using get command

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

WinSCP.JPG

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,532
Location:
Prague, Czechia

Re: Transfering files using get command

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

Reply with quote

NU
Guest

Re: Transfering files using get command

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.

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum