This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.
For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message. 
	 
Help for those learning Tcl or writing their own scripts.
			
		
				
			- 
				
								Madalin							
- Master
- Posts: 310
- Joined: Fri Jun 24, 2005 11:36 am
- Location: Constanta, Romania
- 
				Contact:
				
			
						
					
													
							
						
									
						Post
					
								by Madalin » 
			
			
			
			
			
			Can anyone tell me what is wrong with this code? When its tested to upload only 1 file it works ok but whene i make it do add multiple files it fails.
Code: Select all
proc timed:upload {m h d m y} {
	global ftp
	set ftpx [open "|ftp -n $ftp(host)" w]
	puts $ftpx "user $ftp(user) $ftp(pass)"
	puts $ftpx "bin"
	foreach file [lsort [glob -directory $ftp(dir) *]] {
		if { [file readable $file] && [file isfile $file]} {
			puts $ftpx "put $file ${ftp(updir)}${file}"
			putlog "${ftp(updir)}${file}"
		}
	}
	puts $ftpx "quit"
	close $ftpx
	putlog "FTP: all files in $ftp(dir) uploaded successfuly to $ftp(host)"
}