Solved

ws ftp 12 script tool

Posted on 2011-03-04
3
2,627 Views
Last Modified: 2012-05-11
Am trying to build a script that -

logs on to an existing ws ftp remote site
opens a directory on the site
locates a file on the directory
delets the file
opens a local directory
locates a file on the directory
uploads file from local directory to server directory
closes connection

Please advise - thanks

Am using WS FTP Pro 12
0
Comment
Question by:garethtnash
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 4

Accepted Solution

by:
ChuckDeezel earned 250 total points
ID: 35039856
Check out this reference site. It has a good reference section.

http://support.ipswitch.com/kb/WS-20010103-DM01.htm

And here is a sample script:

http://ipswitchft.custhelp.com/app/answers/detail/a_id/446
0
 
LVL 16

Assisted Solution

by:AlexPace
AlexPace earned 250 total points
ID: 35043734
This is sort of off-topic but you might consider using Robo-FTP this sort of task.  The basic script for your workflow would looke like this:
FTPLOGON "127.0.0.1" /user="myuserid" /pw="mypassword"
FTPCD "RemoteSubDirectory"
FTPDELETE "file.old"
WORKINGDIR "c:\data\local"
SENDFILE "file.new"
FTPLOGOFF

Open in new window


So thats not really a lot different than what you would have in WS FTP but with Robo-FTP you can do error handling and reporting for every step in the process, including the ability to retry steps X number of times like this:
BEGINFUNCTIONS
 FUNCTION SendEmail body_text 
  SET from_name = "Robo-FTP" 
  SET from_addr = "roboftp@domain.com"
  SET recipient = "automationadmin@domain.com"
  SET subj = "Robo-FTP status report (do not reply)"
  SET body = "Robo-FTP statsus report:    " + %crlf + body_text 
  CREATEMAIL from_name from_addr subj body "" /nocrlf
  SENDMAIL "127.0.0.1" "" recipient 
  RETURN
ENDFUNCTION
ENDFUNCTIONS

:step1
LOOPCOUNT 3
FTPLOGON "127.0.0.1" /user="myuserid" /pw="mypassword"
LOOPIF GOTO step1 ELSE GOTO step2
SendEmail "Unable to connect to remote server after 3 tries."
GOTO done

:step2
FTPCD "RemoteSubDirectory"
IFERROR= $ERROR_SUCCESS GOTO step3
SendEmail "Unable to access sub-folder on remote site."
GOTO done

:step3
GETSITEFILE "file.old"
IFERROR= $ERROR_SUCCESS GOTO step4
; old file does not exist on remote site
GOTO step5

:step4
FTPDELETE "file.old"
IFERROR= $ERROR_SUCCESS GOTO step5
SendEmail "Unable to delete old file from remote site."
GOTO done

:step5
WORKINGDIR "c:\data\local"
IFERROR= $ERROR_SUCCESS GOTO step6
SendEmail "Unable to access local sub-folder."
GOTO done

:step6
GETFILE "file.new"
IFERROR= $ERROR_SUCCESS GOTO step7
SendEmail "Can't upload because local file does not exist!"
GOTO done

:step7
LOOPCOUNT 3
SENDFILE "file.new"
IFERROR= $ERROR_SUCCESS GOTO success
LOOPTO step7
SendEmail "Failed three tries to upload new file."
GOTO done

:success
SendEmail "The upload process completed successfully."

:done
FTPLOGOFF
EXIT

Open in new window

If this specific situation is on the high end of your automation needs then it probably isn't worth the time and effort to switch FTP platforms but if you do a lot of complex repetitive file transfers you might want to give Robo-FTP a try.  For sake of comparison here is a list of Robo-FTP script commands from the help file: http://www.robo-ftp.com/help/3.7/script_commands_grouped_by_function.htm
0
 

Author Closing Comment

by:garethtnash
ID: 35072841
Big thanks :)
0

Featured Post

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
WARNING:   If you follow the instructions here, you will wipe out your VTP and VLAN configurations.  Make sure you have backed up your switch!!! I recently had some issues with a few low-end Cisco routers (RV325) and I opened a case with Cisco TA…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question