ftp automation

ScriptFTP

The professional tool to automate FTP, SFTP, FTPS and schedule FTP batch jobs

The forum is now read only. Please, go to the the main ScriptFTP website if you need help.
Need help writing a script? Have any question about ScriptFTP?
Hi .
In a script using the function GETLIST i can build a list of files to send and then using FOREACH i can get (or put) the single file.
After sending (or receiving) i need to change the name of the file just before the suffix to specify that the file was sent successfully:
from abcd.xls i need to rename into abcd.sent.xls.
Is it possible to have the value of the suffix (.xls), its position in the string and the name of the file without suffix?
Best regards
FTP Script
  1. $aFileName = "File_Name.Ext"
  2.  
  3. $i = TEXTLENGTH($aFileName)
  4. $aName = $aFileName
  5. $aExt = ""
  6. WHILE($i > 0)
  7.   IF(TEXTCUT($aFileName, $i, 1) == ".")
  8.     $aName = TEXTCUT($aFileName, 1, $i-1)
  9.     $aExt = TEXTCUT($aFileName, $i+1, TEXTLENGTH($aFileName)-$i)
  10.     $i = 0
  11.   END IF
  12.   $i = $i-1
  13.  
  14. PRINT("Full Name: ".$aFileName)
  15. PRINT("Name: ".$aName)
  16. PRINT("Extension: ".$aExt)
Thanks for answering Wandrey