Yesterday's log file - ftp


Recommended Posts

What was the script to ftp yesterday's log file - it seems to have gone missing ?

Link to comment
Share on other sites

Missing from where? I think its in that long thread we had on FTP. Anyhow, you just need to save the current name of the log file before trying to change it. Something like:


private string curName = logging.myLog.strFileName
logging.myLog.strFileName = formatdatetime("c:\mydata\mydata_%y%m%d.csv",systime())
if (logging.myLog.strFileName != curName)
DoFtp(curName)
endif

[/CODE]

where DoFtp is some sort of function you create to do the ftp with the file name passed in.

Link to comment
Share on other sites

Thanks for that. I found the other one - it was posted under scripting;

It was:


while (1)
delay(1)
// set logging file name:
yesterday = logging.Field_Sensor_log.strFileName
logging.Field_Sensor_Log.strFileName = "C:\Users\hschiret\Documents\UNE_MonoEvap_Project\Log_Files\Daily_Field_Log_"
+ formatdatetime("%d_%m_%y",SysTime()) + ".csv "
if (yesterday != logging.Field_Sensor_log.strFileName)
// new day, so upload yesterday's file
sendFTP(yesterday, "/data/Daily_Field_Log_" + formatdatetime("%d_%m_%y",SysTime() - 86400) + ".csv "
// and repeat
endwhile
[/CODE]

Now as I explained elsewhere, the website I wish to upload these files to is on a Linux server that uses sftp (not supported by DAQFactory) so I have to use an external program, in this case WinSCP http://winscp.net/en...cs/introduction

So, what I need to do is from within the DAQFactory sequence, pass the (exact) filename of yesterdays log file (not some other name such as "yesterday.csv") to either a] the external sftp application or, b] a batch file that handles the connection.

The question then is in two parts, namely;

  1. How do I call an external program passing the exact file name to it?
  2. If a batch is the chosen option - I don't know how to pass a filename directly to a batch file - I don't even know if that's possible ?

Link to comment
Share on other sites

Sure, first you can use system.shellExecute() to run an external program. In that function you can pass parameters, so presumably your file path. As for using a a batch file, you can also do parameters to a batch file. You'll have to search the internet on how to create a batch file that takes parameters, but if I remember correctly, you put %1, %2 in your batch file where you want to insert the parameter.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.