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

Posted on 2006-04-28
Last Modified: 2013-12-24
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
Stand by... Files are being copied...<br /><br />

<cfoutput query="getFiles" >

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

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

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: \\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?

Question by:Bauerchick

    Author Comment

    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!

    LVL 5

    Accepted Solution

    Hi Farmer Chick, cffile cannot interact with the user's computer in this manner. the destination is the path on the coldfusion server. Now about the idea of using a network map as in: destination= \\theLaptopNameOfUser\C$\blah\blahsub\ might be possible, but that person would have to have that folder set up with permissions to the coldfusion server and you would have to get the computer name which would be possible by creating custom hyperlinks with some security checks. I'm not even sure that network access would work as I've never tried.

    You would probably need to write a java applet to handle this.

    Author Comment

    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.

    LVL 5

    Expert Comment

    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.


    Author Comment

    Do you have another way to do this beside DOS using a web page to trigger it?
    LVL 5

    Expert Comment

    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.

    Featured Post

    Network it in WD Red

    There's an industry-leading WD Red drive for every compatible NAS system to help fulfill your data storage needs. With drives up to 8TB, WD Red offers a wide array of solutions for customers looking to build the biggest, best-performing NAS storage solution.  

    Join & Write a Comment

    When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
    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 …
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    729 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

    22 Experts available now in Live!

    Get 1:1 Help Now