' Listing 2. GenFtpScript.vbs Const root = "D:\msgup" Const scriptnam = "D:\msgup\msgup.ftp" Const ftplog = "D:\msgup\ftp.log" Set fs = CreateObject("Scripting.FileSystemObject") ' Open the log in append mode, and add the date and timestamp for the current session. Set f_log = fs.OpenTextFile(ftplog,8,TRUE) f_log.writeline("") f_log.writeline("=============================") f_log.writeline("New ftp session " & now()) f_log.writeline("=============================") f_log.close ' Create an FTP script. Set startfolder = fs.GetFolder(root) ' Get the file collection. Set filc = startfolder.Files Set f_out = fs.CreateTextFile(scriptnam,TRUE) ' Add the logon code. ' BEGIN CALLOUT A f_out.writeline("user ftpuser 12xy34z") ' END CALLOUT A ' Add the code that uses the put subcommand to copy the files. For Each fil in filc ' BEGIN CALLOUT B If right(fil.name,3) = "ASC" Then ' END CALLOUT B f_out.writeline("put " & fil.name) End If Next ' Write the code that uses the dir subcommand to list the copied files. f_out.writeline("dir") ' Write the code that uses the bye subcommand to log off. f_out.writeline("bye") f_out.Close