Link to home
Start Free TrialLog in
Avatar of Bauerchick
Bauerchick

asked on

Copy Files from Network Drive to Local PC using CFFILE (?)

Hi,
I need to transfer files to local pc's on demand. This is used to keep some remote computers, and laptops, updated with critical data for use in the field. The concept is that the field crew brings it's laptop into the building and connects to the network. Then they navigate to a very simple web page with a "Click Me to update your files" button. The paths to both the source and destination files are maintained in a sql table, and I intended to use a cfquery in a cfloop around a cffile command to copy files from a network location to their C drive.  Here is a sample of the data involved....

*******************************************************
SQL Table GIS_PWUpdateFiles:

TransferID          1
Source                \\cobdata7\d$\dept\cddroot\cdd1\gis-cov\cob\boundary\bv_fill.*                                  
Destination           c:\gisdata\cob\          
Workgroup          PW

*******************************************************
The page that starts up when they click the button:

<cfquery datasource="GIS_CoreData17" name="getFiles">
      Select source, destination, workgroup
      from dbo.GIS_PWUpdateFiles
      Where workgroup like 'PW%'
      Order by TransferID
</cfquery>
      
Stand by... Files are being copied...<br /><br />

<cfoutput query="getFiles" > 

          <cffile action="copy"
      source = "#source#"
      destination = "#destination#">

#source#. . . was copied to . . . #destination#<br />

</cfoutput>
***************************************************
For some reason, this just doesn't work. I have tried multiple styles of entering the path/file names for both source, and destination but it still croaks with an error -

Either something like ...
===========================================================================
[Attribute validation error for tag CFFILE - The value of the attribute destination, which is currently "c:\gisdata\cob\", is invalid. ]
===========================================================================

or something like...
======================================================================
[An exception occurred when performing a file operation copy on files \\cobdata7\d$\dept\cddroot\cdd1\gis-cov\cob\boundary\bv_fill.* and c:\gisdata\cob.
 
The cause of this exception was: java.io.FileNotFoundException: \\cobdata7\d$\dept\cddroot\cdd1\gis-cov\cob\boundary\bv_fill.* (Access is denied).]  
======================================================================

This is a pretty simple file copy which I want to do through a web interface rather than a batch file. I don't want to specify all the exact file names specifically and would like to use *.* whenever possible. I am open to other solutions besides CF (asp?), but I like CF and would like figure out how to use it to solve this, if possible.

Can anyone help on this?

Avatar of Bauerchick
Bauerchick

ASKER

I guess Friday afternoon is not the best time to post a question....

No worries, I will be back at it on Monday and will check to see all the wonderful ideas the experts have proposed...

Hope you all have a great weekend!

ASKER CERTIFIED SOLUTION
Avatar of jtreher
jtreher

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Geez,
Maybe I should just use a .bat file and cflocation...? Seems a lot simpler.
Kind of crazy that we can't perform a very simple operation like this using the web... and have to resore to DOS to accomplish it. Good thing I learned DOS in the old days.

I'll leave this open a little while longer in hopes that someone will have a brilliant idea.

Bauerchick
Well, you must not forget that you are dealing with an Internet application. There are certain security steps taken so this very thing doesn't happen. Sure there are holes, but they are often filled. Would you want any  coldfusion programmer to be able to easily load files on your computer? Just remember that coldfusion cannot interact with the client. It is not what coldfusion or any other web language is meant to do.

Do you have another way to do this beside DOS using a web page to trigger it?
I can't think of anything other than using some of the windows networking tools or a login script. This is definitely not something to be doing over the web.