Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > ftp script wanted!

ftp script wanted!
Thread Tools
Forum Regular
Join Date: Oct 2000
Location: solna, sweden
Status: Offline
Reply With Quote
Oct 28, 2000, 11:48 AM
 
Im looking for a script that can, with timed intervals. download/empty an ftp. It should be able to tell if an objekt is finished uploaded or not.

hopefull...
The real MacMicke™
     
Dedicated MacNNer
Join Date: Nov 1999
Location: Georgetown, Demerara, Guyana
Status: Offline
Reply With Quote
Nov 1, 2000, 05:31 AM
 
Hi macmicke,

If you haven't already done so, check out Apple's URL Access Scripting, one of the AppleScript Guidebook Modules. It installs as an additional help "book" in the Help Centre of Mac OS 8.6 or 9.x, and contains several tips and sample scripts for automating downloads & uploads via the commands in the 'URL Access Scripting' OSAX introduced in Mac OS 8.6.

The module also contains examples of retrieving and parsing FTP directory listings, which might allow you to use a size-based technique to determine whether a file has been completed uploaded. In other words, you could try using a 'repeat' loop to continually retrieve & parse the directory listing (with a suitable 'delay <n>' command after each retrieval+parsing to allow enough time for size updates, if any). If the size of any file was still increasing, then you would just continue looping; otherwise, you would immediately break out of the loop with an 'exit repeat' command. Note that some FTP servers report the initial size of an uploading file as 0, but then do not refresh it until the file has been completely uploaded; in that case, you could simply test whether each file's size is > 0. Nevertheless, parsing the directory listing might also allow you to detect whether additional new files were still coming in.

Once you've written/tested/saved the script, you could then use 'iDo Script Scheduler' or a similar program to run it at the desired interval(s). 'iDoSS' is distributed in the 'CD Extras -> AppleScript Extras' folder of the Mac OS 8.6 & 9.x CD-ROMs. It's also available online directly from Sophisticated Circuits' download page, or via Apple's AppleScript Extras package.

Regards,

--Paul
     
Forum Regular
Join Date: Oct 2000
Location: solna, sweden
Status: Offline
Reply With Quote
Nov 1, 2000, 05:35 AM
 
Thanx a million....

I will soon be scripting like crazy :-)


The real MacMicke™
     
Dedicated MacNNer
Join Date: Nov 1999
Location: Georgetown, Demerara, Guyana
Status: Offline
Reply With Quote
Nov 1, 2000, 03:20 PM
 
Hi again,

I wish you very happy scripting! [Alhough, I just realised that you also wanted to empty the FTP server's directory after dowloading everything, right? I doubt whether 'URL Access' currently has commands for deleting remote files. It seems that even Mango Tree Software's TCP/IP Scripting Addition commercial OSAX won't let you do that, at least not easily. So, you may need to use a scriptable FTP client such as Dartmouth College's Fetch (freeware for .edu/.org folks; otherwise, $25 Single-User) or Interarchy's self-named Interarchy (shareware, $25 Single-User). And, of course, if you're ever so lucky as to have an FTP server that's actually an AppleShare IP server or is AFP-compliant, you could probably just mount the remote directory as a volume on your desktop and use the standard scriptable Finder commands to copy & erase files! ;-)]

Do let us know how things turn out.

Regards,

--Paul

[This message has been edited by Paul Crawford (edited 11-01-2000).]
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 11:01 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2