| | | Forum Newbie
       
Group: Forum Members Last Login: 8/14/2008 12:35:07 PM Posts: 1, Visits: 15 |
| | I am going to post the sample script I have and then say what I hope it does- TRACE C:\test\testDownloadLog.txt ----- output a log file to the local system downloading files CONNECT Test ------ Connect to test site?? CD /users/test/hl7results ------- Change directory on the FTP server to hl7results LCD C:\test\reports -------Change directory again to reports direcory ONSUCCESS GOTO FILEDELETE -------- This I hope deletes the files that were successfully download??????? ONERROR GOTO DISCONNECT ------- Obvious MGET *.txt -------- Download all .txt files LABEL FILEDELETE ---------- labels files to be deleted ??? MDELETE *.txt --------- Deletes all .txt files LABEL DISCONNECT ----------- Disconnects ?? CLOSE ----------Closes
To rap up- what I want to do is connect to a remote FTP server download a few hundred small txt files- delete the files that were successfully downloaded and then disconnect. I would like to schedule this to happen a few times a day.
Newb Alert!!! |
| | | | 
Forum Newbie
       
Group: Forum Members Last Login: 9/19/2008 1:30:09 PM Posts: 8, Visits: 26 |
| | The script you posted should do exactly what you want it to do with a few changes. The first thing is to change the first line to use LOG not TRACE of you want a log file generated in the specified directory with the specified name. The second thing I would do would be to remove the ONSUCCESS and LABEL FILEDELETE lines as they are not needed. If everything is successful the script will continue to run, doing what you want it to do, without these lines. You only need the ONERROR line in case the transfer fails so you can close the connection without deleting the files. |
| | | | Forum Newbie
       
Group: Forum Members Last Login: 10/3/2008 6:54:00 PM Posts: 2, Visits: 10 |
| | I would like to add to the question, or get some clarification. What changes would you make to the script (thanks feedmetwinkes!) if I want to ensure only successfully transferred files are deleted? I have a situation where files are being added to the local folder while the script to delete is in process, or I get an error during transfer where some files were successfully transmitted, others fail. I want only those that transferred deleted. Is there a way to 'mark' the successfully transferred files, then delete only the 'marked' files? Thank you much! |
| | | | Forum Newbie
       
Group: Forum Members Last Login: 10/3/2008 6:54:00 PM Posts: 2, Visits: 10 |
| | FYI - for anyone wanting to know a way to move and delete files locally (may not be pretty, but it worked). TRACE screen SHELL move c:\temp\*txt c:\temp\temp2 CONNECT (the REMOTE site name)ONERROR GOTO guitLCD c:\temp\temp2MPUT *.txtCLOSE CONNECT (the LOCAL site I created that connects to c:\temp\temp2)MDELETE *.txtLABEL quitCLOSE |
| |
|
|