• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Scripting Terminal for simple FTP
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scripting Terminal for simple FTP


  • Subject: Re: Scripting Terminal for simple FTP
  • From: Chris Janton <email@hidden>
  • Date: Sun, 06 Apr 2003 07:13:54 -0700

On Saturday, April 5, 2003, at 07:48 PM, email@hidden wrote:

I want an AppleScript to use the terminal to login to the server using
a
specified username/password and download only the latest filexx.txt
file
which right now may be file03.txt, but tomorrow might be file04.txt

I want the script to automatically decide which file to download,

No Terminal required...

set myFile to do shell script "curl --list-only ftp://user:password@host/ | egrep file[0-9]+.txt | sort | tail -n 1"
set myFileContents to do shell script ("curl ftp://user:password@host/"; & myFile)

There are only 2 lines in the script...

The first command tells curl to get a listing of files from the host, search it for the name of the target file, sort the results (just in case the directory listing isn't in order), and select the last (highest) line from the listing.

The second command tell curl to go get the file.

8)
----------------------------------
Chris Janton - face at CentosPrime dot COM
Netminder for Opus1.COM
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Scripting Terminal for simple FTP
      • From: Joshua See <email@hidden>
  • Prev by Date: Re: Weird info for/choose file prompt issue
  • Next by Date: Mail: mailboxes in folders
  • Previous by thread: Re: Scripting Terminal for simple FTP
  • Next by thread: Re: Scripting Terminal for simple FTP
  • Index(es):
    • Date
    • Thread