hello I am trying to create a .txt file to send via ftp. No problem so far. But I need the file to change its name to include the last recorded date in the name. Every five minutes I need: Name: 202210051025 Data: 202210051025;10.52 Name: 202210051030 Data: 202210051025;10.52 202210051030;10.75 Name: 202210051035 Data: 202210051025;10.52 202210051030;10.75 202210051035;11,15 Thank you very much Cheers
Do you have the name of the file in a variable already?
If the only place you can get that date and time is from the file, then use the combination of FileOpen and FileReadLine instructions in a loop to get the last line of the file in to a variable. See CRBaisc Help for FileReadLine which has an Example which shows how to do this. Extract as follows :-
Loop Until ReadFile2=-1
Once you have the last line of the file in a variable, you can then use text manipulation instructions to get just the string you want as the filename in a variable.
When you send the file using FTPClient, send the same name of file everytime, say "DataImportOriginal".
Once the file is sent, then use the FTPClient instruction to rename this default filename on the server to the actual filename you want. Rename option 5 (FTP) or 15 (SFTP) in PutGetOption parameter of FTPClient.
Thanks a lot
the option does just what I need
this allows me to greatly simplify the management of files in the datalogger.