set remIp		1.1.1.1
set user		test
set passwd		test123
set files		[ list of files that is created dynamically via files on the local machine ]
set remFtpPath	destPath

while {1} {
	
	puts "Connecting to $remIp ..."
	if { [ set fh [ ftp::Open $remIp $user $passwd -timeout 120 ] ] != -1 } {
		
		puts "Cd'ing to $remFtpPath ..."
		set response [ ftp::Cd $fh $remFtpPath ]
		
		if { $response } {
			
			puts "Gathering bin file list from $remIp ..."
			set rfiles [ ftp::List $fh *.bin ]
			
		}
		
		foreach rfile $rfiles {
			
			lappend images [ lindex $rfile end ]
			
		}
		puts "IMAGES: $images"
		
		foreach file $files {
			
			if { [ lsearch -exact $images $file ] < 0 } {
				
				puts -nonewline "Copying $file to $remFtpPath on $remIp ... "
				flush stdout
				
				# Copy files to target dir
				if { [ ftp::Put $fh $file ] } {
					
					puts "succeeded"
					
				} else {
					
					puts "failed"
					
				}
				
			}
			
		}
		
		ftp::Close $fh
		
	}
	
	after 60000
	
}
