• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 313
  • Last Modified:

SCP In Cold Fusion 6?

How to do it?
  • 3
  • 3
1 Solution
afaik you can't natively

I created a procedure to grab a daily xml file from my site via scp

 what I have done is:

set up cygwin on the windows server and an ssh server
created a ssh user and keyfile
created an ant script to login copy the file via scp and then delete the remote file (s)

<project name="CopyRemoteXML" default="GetFiles" basedir=".">
<echo> ${ant.version}</echo>
      <target name="GetFiles">
<scp trust="true" keyfile="C:\pathtoMyKeyfile\sshKey" toDir="\\server\xml\" passphrase="" file="somelogin@someco.com:/cygdrive/d/somedir/xml/*.xml">
<sshexec host="someco.com" username="somename" trust="true" keyfile="C:\pathtoMyKeyfile\sshKey"
 command="rm /cygdrive/d/somedir/xml/*.xml"/>

then I created a vbs script to run the ant script and write a log entry. I added the it to windows task scheduler to run every night

Set ObjWS = WScript.CreateObject("WScript.Shell")
ObjWS.Run ("C:\Eclipse\eclipse\plugins\org.apache.ant_1.6.5\bin\ant -buildfile \\server\scripts\build.xml")

strFileName = "\\server\xml\logs\fetchlog.txt"
strContent  = "Script Ran at:" & Now()  & vbNewLine

Set objFS = CreateObject("Scripting.FileSystemObject")
Set objTS = objFS.OpenTextFile(strFileName,FOR_APPENDING)
objTS.Write strContent

You could run this vbs script via cfexecute or cfschedule
KCarter80Author Commented:
Any body have any experience doing this on Linux (Redhat ES 3) boxes running CF?
that should be even easier(i think)  since scp is native to the OS

something like this perhaps...
  name = "scp"
  arguments = "somefile.txt username@someplace:somedir/"
  timeout = "6000">

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

KCarter80Author Commented:
This is close to what I need.


I'd like to use CF 6.1 (on a Red Hat server) to SCP a file to a remote host.

CF runs as the nobody user. So I can't set up a key exchange since the nobody user doesn't have the usual directories to put the key in.

Anyone have any thoughts on how to do this?
at minimum i'd say paq since my original solution works for windows folks and has value...(not that the original q was specific at all)...as for the points ...whatever
KCarter80Author Commented:
The windows solution does work in windows. Was never able to find a solution in Linux. Will accept the windows solution.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now