Solved

coldfusion running commands in windows

Posted on 2004-03-23
3
200 Views
Last Modified: 2013-12-20
How do I run batch commands from coldfusion?  Windows 2k server.

I'm trying to do FTP things that CFM can't seem to do with cfftp (like delte an entire directory w/out having to recusively loop).
0
Comment
Question by:happydog234
3 Comments
 
LVL 17

Accepted Solution

by:
Tacobell777 earned 500 total points
ID: 10663303
You could use <cfexecute> and use the windows ftp, i.e. command line ftp 192.168.200.1
0
 
LVL 4

Expert Comment

by:sandy12879
ID: 10664673
cfftp tag lets u perform tasks on remote server using file transfer protocol(ftp).

You can use cfftp to cache connections for batch file transfers when uploading or downloading files.

Just a pseudo code for u

html>
<head>
   <title>FTP Test</title>
</head>

<body>
<h1>FTP Test</h1>
<!--- Open ftp connection --->
<cfftp connection="Myftp"
   server="MyServer"
   username="MyUserName"
   password="MyPassword"
   action="Open"
   stoponerror="Yes">

<!--- Get the current directory name. --->
<cfftp connection=Myftp
   action="GetCurrentDir"
   stoponerror="Yes">

<!--- output directory name --->
<cfoutput>
   The current directory is:  #cfftp.returnvalue#<p>
</cfoutput>

<!--- Get a listing of the directory. --->
<cfftp connection=Myftp
   action="listdir"
   directory="#cfftp.returnvalue#"
   name="dirlist"
   stoponerror="Yes">
<!--- Close the connection.--->
<cfftp action="close" connection="Myftp">
<p>Did the connection close successfully?
   <cfoutput>#cfftp.succeeded#</cfoutput></p>

<!--- output dirlist results --->
<hr>
<p>FTP Directory Listing:</p>

<cftable query="dirlist" colheaders="yes" htmltable>
   <cfcol header="<B>Name</b>" TEXT="#name#">
   <cfcol header="<B>Path</b>" TEXT="#path#">
   <cfcol header="<B>URL</b>" TEXT="#url#">
   <cfcol header="<B>Length</b>" TEXT="#length#">
   <cfcol header="<B>LastModified</b>"
   TEXT="#DateFormat(lastmodified)#">
   <cfcol header="<B>IsDirectory</b>"
      TEXT="#isdirectory#">
</cftable>


After you establish a connection with cfftp, you can reuse the connection to perform additional FTP operations .

regards
Sandy
0
 
LVL 5

Expert Comment

by:Seth_Bienek
ID: 10684607
If you're wanting to run a batch FTP process (as from the command line), save your script in a batch file (need help with this? it sounds like you may already know the ropes in this arena), then call the batch file from CF using <cfexecute>:

<cfexecute name="c:\batchfiles\ftpscript.bat" timeout="600" outputfile="c:\batchfiles\log.txt">
</cfexecute>

You have to remember to add the closing tag, even though there's nothing in the middle.

Hope this helps,

Seth
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Script 12 134
Unsearchable in Google,Yahoo and Bing. 6 58
Build and evolve an interactive experience 1 89
Problem to get function 52 100
When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure (http://www.axure.com/). It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…

910 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now