Skip to main content
Known Participant
April 25, 2008
Question

CFFILE move action

  • April 25, 2008
  • 2 replies
  • 1049 views
I need to use CFFILE move action to move 600 or more files from one folder to another in different server.
1. in the fromPath do I have to include the name of file to moved?
2. if there are more than 600 files, how to do this without slowing down the process.

<cffile action="MOVE" source="#FromPath#" destination="#ToPath#"> >> this may work for moving one file
how to move more than 600 different files?
This topic has been closed for replies.

2 replies

Inspiring
April 25, 2008
alecken wrote:
> I need to use CFFILE move action to move 600 or more files from one folder to
> another in different server.
> 1. in the fromPath do I have to include the name of file to moved?
> 2. if there are more than 600 files, how to do this without slowing down the
> process.
>
> <cffile action="MOVE" source="#FromPath#" destination="#ToPath#"> >> this
> may work for moving one file
> how to move more than 600 different files?
>

<cffile...> by itself is not going to do this for you. You will need to
combine it with <cfdirectory...> and some type of loop such as
<cfoutput> or <cfloop>.

SafariTECH wrote:
> If they are separate servers CFFILE likely will not work because it
interacts
> with the local directories, not remote directories.

Actually <cffile...> and <cfdirectory...> can work wit remote
directories. As long as both systems are on a well defined network and
the CF server is running as a user with the required permissions to
access the remote computer over the network.

Inspiring
April 25, 2008
If they are separate servers CFFILE likely will not work because it interacts with the local directories, not remote directories.

If you have the drives properly mapped, it may work, but you may want to try doing something with FTP.

JMO since I don;t know the exact setup of your service.


If both servers are CF servers and running CF8, you could zip up all the files, send the one file to the other location, then unzip the files on the new machine.
aleckenAuthor
Known Participant
April 25, 2008
I'm currently still in development process, I would think it will be within the same server especially when I look at similar project.
Assuming it is within the same server, I did the following (see blow). It works for smaller files (below 300) but when I tested with 800 files I got time out error (see below). Can anyone help with a better solution?

<CFDirectory action="list" directory="#PrintedPDFPath#" name="DirQuery">

<cfquery name="GetFilesOrderred" dbtype="query">
select name from DirQuery where type='File'
</cfquery>

<CFLOOP query="GetFilesOrderred">
<cffile action="MOVE" source="#PrintedPDFPath##GetFilesOrderred.Name#"
destination="#DestinationFolder#" attributes="normal">
</CFLOOP>

Here is the error I got:
Error Occurred While Processing Request
The request has exceeded the allowable time limit Tag: CFQUERY