moved ftp.txt creation into a function