Hello All: ISSUE: CFFTP all .txt files in a given directory.
I'm trying to have code that will FTP all the .txt files in a directory to another server. Can anyone help me out here? I would also like to know if the files names are in a date format can I perform a range and have only certain files be selected for the ftp? Example of May 17, 2002 = 05172002.txt Sincerely, James Blaha <CFFTP CONNECTION="movefiles" USERNAME="anonymous" PASSWORD="guest@unknown" SERVER="172.17.89.157" ACTION="Open" STOPONERROR="Yes"> <!--- Get a File For the get function, both the remote file and the name it will have on the local server must be specified. The transfer mode is set explicitly here for clarity, but cfftp will usually make the right choice based on file extension anyway (and its default list of extensions with which ASCII mode should be used is easily changed). Call this code rget.cfm. ---> <!--- <cfftp connection="movefiles" action="GetFile" remotefile="untitled.txt" localfile="C:\Inetpub\wwwroot\CFFTP\file_folder\untitled.txt" transfermode="binary" timeout="30" retrycount="3" stoponerror="no" failifexists="no"> ---> <cfftp connection="movefiles" action="GetFile" REMOTEFILE="/" localfile="C:\Inetpub\wwwroot\CFFTP\file_folder" transfermode="binary" timeout="30" retrycount="3" stoponerror="no" failifexists="no"> <!--- Delete a Local File The command to delete a local file is actually a one-liner that's pulled out into a separate file for clarity. The file parameter consists of the path to the script (set by view.cfm), the directory below it that holds these files, and the name of the file. Call this code ldel.cfm. <cffile action="delete" file="#scriptdir#/stuff/#mydel#"> ---> <!--- Close a Remote Connection If you don't close the connection, it will tie up resources of two computers until the remote server eventually times it out. Call this code rclose.cfm. ---> <cfftp connection="movefiles" action="close"> <p>When this page is accesed the text files from "cfftp" are tranfered to "file_folder".</p> <p><CFFTP CONNECTION=FTP USERNAME="anonymous" PASSWORD="guest@unknown" SERVER="172.17.89.157" ACTION="Open" STOPONERROR="Yes"> <CFFTP CONNECTION=FTP ACTION="GetCurrentDir" STOPONERROR="Yes"> </p><CFOUTPUT> FTP directory listing of #cfftp.returnvalue#.<p> </CFOUTPUT> <CFOUTPUT> Return is #cfftp.returnvalue# </CFOUTPUT><BR> <CFFTP CONNECTION=FTP ACTION="ListDir" DIRECTORY="//file_folder" NAME="ListFiles" STOPONERROR="Yes"> <HR> <form name="ftpfiles" method="post" action="ftpfiles.cfm"> <h3>FTP Directory Listing:</h3> <cftable query="ListFiles" HTMLTABLE> <cfcol header="<B>Name</B>" text="<B>Name:</B> #name#"> <cfcol header="<B>Path</B>" text="<B>Path:</B> #path#"> <cfcol header="<B>URL</B>" text="<B>URL:</B> #url#"> <cfcol header="<B>Length</B>" text="<B>Length:</B> #length#"> <cfcol header="<B>Date Formted</B>" text="<B>Date Formatted:</B> #DateFormat(LastModified)#"> <cfcol header="<B>IsDirectory</B>" text="<B>IsDirectory:</B> #isdirectory#"> </cftable> ______________________________________________________________________ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists