image
image

|


Go Back   macosx.com > Mac Help Forums > Mac OS X System & Mac Software

Reply
 
Thread Tools
  #1  
Old October 12th, 2006, 07:30 AM
Registered User
 
Join Date: Apr 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Brandon.Bohling is on a distinguished road
Automator: Building an FTP Workflow

I realize to the Automator pros this is dead simple, but for a newbie I am having a heck of a time. All I want to do is build a workflow that...

1) downloads (to my local system) two files from my FTP site
2) uploads those same two files to a different location on my FTP site

I've come close, but when the files are saved to my local system instead of being saved as sitemap.xml (as it should) it is being saved as: Sitemap\files\sitemap.xml, which is my FTP path. I suppose I could add the rename feature in the workflow, but I would think I should be able to save the files correctly. Or better yet, not even have to save to my local system.

Anyone help the challenged?
Reply With Quote
  #2  
Old October 12th, 2006, 11:45 AM
macworks's Avatar
Christopher Raymond
 
Join Date: Mar 2006
Location: Minneapolis, MN
Posts: 444
Thanks: 0
Thanked 0 Times in 0 Posts
macworks is on a distinguished road
Have you tried using Transmit as your FTP program? I believe it has some Automator actions available with/for it.
__________________
Christopher Raymond
ACTC

Owner/Operator: MacWorks
Reply With Quote
  #3  
Old November 5th, 2006, 08:03 AM
bobw's Avatar
The Late: SuperMacMod
 
Join Date: Mar 2001
Location: Phila,PA
Posts: 8,835
Thanks: 0
Thanked 1 Time in 1 Post
bobw has a spectacular aura aboutbobw has a spectacular aura about
FTP in the Finder is read only. Take a look at this;

http://docs.info.apple.com/article.html?artnum=107415

I can't help with this, just doing some searching for you.

Go here;

http://discussions.apple.com/index.jspa

Open the Tiger Forum then 'Automator' and post this in there. A lot of folks there with experience may be able to help.

Also, go to the;

http://bbs.applescript.net/

forum and open the Automator forums. A lot of very good folks there.

Hope this helps.
__________________


Last edited by bobw; November 5th, 2006 at 09:37 AM.
Reply With Quote
  #4  
Old November 5th, 2006, 10:43 AM
Registered User
 
Join Date: May 2005
Posts: 1,339
Thanks: 0
Thanked 1 Time in 1 Post
barhar is on a distinguished road
While there are FTP applications that have associated 'Automator' actions and / or AppleScript scripts - either by the applications' creator(s) or others ... there are also other ways to download and / or upload via FTP files - without any application(s).

Place the following code in to a 'Script Editor' window, or into an 'Automator's 'Automator' library 'Run AppleScript' action panel -

----- Code starts here.

set user_Name to "your_user_name" - User Name.
set pass_Word to "your_password" -- Password

set file01 to "file01.ext" -- File to download.
set file02 to "file02.ext" -- File to download.

set tDirectory to "upload_directory" -- Directory to upload to.

set bURL to "ftp_Server_Address" -- FTP server.

set tDate to do shell script ("date +%Y%m%d/")

try
do shell script ("mkdir $HOME/Desktop/" & tDate & "/")
end try

-- Download file01.
try
do shell script ("curl ftp://" & user_Name & ":" & pass_Word & "@" & bURL & "/" & file01 & " >> " & "$HOME/Desktop/" & tDate & "/" & file01)
end try

-- Download file02.
try
do shell script ("curl ftp://" & user_Name & ":" & pass_Word & "@" & bURL & "/" & file02 & " >> " & "$HOME/Desktop/" & tDate & "/" & file02)
end try

-- Upload file01.
try
do shell script ("curl -T $HOME/Desktop/" & tDate & "/" & file01 & " -u " & user_Name & ":" & pass_Word & " ftp://" & bURL & "/" & tDirectory & "/")
end try

-- Upload file02.
try
do shell script ("curl -T $HOME/Desktop/" & tDate & "/" & file02 & " -u " & user_Name & ":" & pass_Word & " ftp://" & bURL & "/" & tDirectory & "/")
end try

----- Code ends here.

... Or, instead - with 'Automator', create an 'Automator' library 'Run Shell Script' panel, and place the following code into it.

----- Code starts here.

#!/bin/bash

user_Name="your_user_name" # User Name.
pass_Word="your_password" # Password

file01="file01.ext" # File to download.
file02="file02.ext" # File to download.

tDirectory="upload_directory" # Directory to upload to.

bURL="ftp_Server_Address" # FTP server.

tDate=$(date +%Y%m%d)

mkdir $HOME/Desktop/$tDate/

# Download file01.
curl ftp://$user_Name:$pass_Word@$bURL/$file01 >> $HOME/Desktop/$tDate/$file01

# Download file02.
curl ftp://$user_Name:$pass_Word@$bURL/$file02 >> $HOME/Desktop/$tDate/$file02

# Upload file01.
curl -T $HOME/Desktop/$tDate/$file01 -u $user_Name:$pass_Word ftp://$bURL/$tDirectory/

# Upload file02.
curl -T $HOME/Desktop/$tDate/$file02 -u $user_Name:$pass_Word ftp://$bURL/$tDirectory/

----- Code ends here.

Basically, two files at the root level of the FTP server are downloaded into a created folder (of the current date) on the 'Desktop'. The downloaded files are then uploaded to the FTP server - into its 'upload_directory' directory.
Reply With Quote
Reply

Thread Tools

Posting 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 Off
Pingbacks are Off
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Automator - workflow help willibook1.42 Mac OS X System & Mac Software 2 October 9th, 2006 12:43 AM
Can I create this workflow with Automator or Applescript? Jean-Marc Zucze Mac OS X System & Mac Software 3 December 6th, 2005 05:48 PM
Automator Workflow error - Help for the inexperienced scripter? JeffCGD Mac OS X System & Mac Software 1 November 24th, 2005 04:55 AM
Automator Workflow Newbie frozendice Software Programming & Web Scripting 0 October 6th, 2005 08:30 PM
Automator workflow doesn't work as Plugin IslandJordan Mac OS X System & Mac Software 3 June 28th, 2005 03:55 PM


All times are GMT -5. The time now is 03:32 PM.


Mac Support® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2000-2008 DigitalCrowd, Inc.