Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

CFFILE move action

Community Beginner ,
Apr 25, 2008 Apr 25, 2008
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?
TOPICS
Getting started
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Apr 25, 2008 Apr 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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 25, 2008 Apr 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 25, 2008 Apr 25, 2008
LATEST
alecken wrote:
> Can anyone help with a better solution?

Increase the timeout value from the default, either globally in the
administrator or specifically in this template with the <cfsetting ...> tag.

This kind of heavy OS manipulation is not really CF's strong suite. If
performance is a concern you may want to look into tapping a language
closer to the OS such as C++ or Java. A routine properly written with
either could be easily tapped with a ColdFusion template to integrate
with a larger CF application if required.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 25, 2008 Apr 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources