Newb scripting questions

To the Ipswitch web site

Ipswitch Forums
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Newb scripting questionsExpand / Collapse
Author
Message
Posted 8/13/2008 11:06:58 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum 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!!!

Post #46230
Posted 8/14/2008 2:39:19 PM


Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum 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.
Post #46296
Posted 9/30/2008 6:01:18 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum 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!  

Post #47381
Posted 10/2/2008 2:04:49 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum 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 guit

LCD c:\temp\temp2

MPUT *.txt

CLOSE

CONNECT (the LOCAL site I created that connects to c:\temp\temp2)

MDELETE *.txt

LABEL quit

CLOSE

Post #47446
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Dave, Mark Singh, kevin r gillis, Jason Benton, Brandon Felger, Ben Henderson, Tripp Allen, Will Sansbury, Jason Williams, Hush, FTPplanet.com, LDW, Hugh Garber, WUP-PM, mmulryan@ipswitch.com, mswimm, Travis G.

PermissionsExpand / Collapse

All times are GMT -5:00, Time now is 7:22pm

Powered By InstantForum.NET v4.1.4 © 2009
Execution: 0.141. 9 queries. Compression Enabled.