Innov-AI
    Documentation | MentDB Weak Server
Generate MQL to UPLOAD files to a remote FTPs connection

  • To generate MQL to UPLOAD files to a remote FTPs connection:
  • Right click on 'demo_cm_ftps' and select 'GEN > UPLOAD FILES'
  • script create post "demo.file.ftps.upload" false 1 
      (param
      	(var "[localDirectory]" {true} "The local directory" is_null:false is_empty:false "/Users/jimmitry/Desktop/ftp")
      	(var "[filter]" {true} "The file filter from the remote directory" is_null:false is_empty:false ".*png")
      	(var "[remoteDirectory]" {true} "The remote directory" is_null:false is_empty:false "/Users/jimmitry/Desktop")
      ;) 
      "Upload file through FTPS" 
    {
    
    	try {
    
    		#Connect to the FTPS server;
    		ftps connect "session1" {cm get "demo_cm_ftps";};
    		ftps set type "session1" "BINARY";
    
    		#Move to the remote directory;
    		ftps cd "session1" [remoteDirectory];
    
    		#Get all local files;
    		json load "files" (file dir_list_regex [localDirectory] [filter] true true);
    
    		#Put all files;
    		-> "[nbFiles]" (json count "files" "/");
    		for (-> "[i]" 0) (< [i] [nbFiles]) (++ "[i]") {
    
    			-> "[filename]" (json select "files" (concat "/[" [i] "]"));
    			
    			ftps put "session1" (concat [localDirectory] "/" [filename]) (concat [localDirectory] "/" [filename]) "RESUME";
    		
    		};
    
    		ftps disconnect "session1";
    	
    	} {
    	
    		#Close objects;
    		try {ftps disconnect "session1";} {} "[sub_err]";
    
    		#Generate an error;
    		exception (1) ([err]);
    	
    	} "[err]";
    	
    	
    } "Return nothing";
  • Update the script and save
  • Execute buttons
Services     Supporters     Contact     About     Legal notice © 2024