Re: copy directory

2004-12-06 Thread Massimo Foti
 Is it possible to copy a directory and all its contents without using 
 cfexecute?

http://www.olimpo.ch/tmt/cfc/tmt_file_io

This CFC does copy, move, delete and more


Massimo Foti
DW tools: http://www.massimocorner.com
CF tools:  http://www.olimpo.ch/tmt/




~|
Special thanks to the CF Community Suite Silver Sponsor - CFDynamics
http://www.cfdynamics.com

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186273
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


copy directory

2004-12-03 Thread Rick Root
Is it possible to copy a directory and all its contents without using 
cfexecute?

I searched cflib.org but didn't find one that would copy a directory

I've thought about using java.util.zip to zip into a tempfile, then 
unzip into the destination directory but that seems like it might be 
overkill =)

-  rick


~|
Special thanks to the CF Community Suite Silver Sponsor - New Atlanta
http://www.newatlanta.com

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186117
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Re: copy directory

2004-12-03 Thread Alex Sherwood
Rick Root wrote:

I would imagine you query the directory and do a simple loop to iterate 
the files and copy them. The zip solution you mentioned might actually 
be less code and faster, in terms of copying.

--
A

Is it possible to copy a directory and all its contents without using 
cfexecute?

I searched cflib.org but didn't find one that would copy a directory

I've thought about using java.util.zip to zip into a tempfile, then 
unzip into the destination directory but that seems like it might be 
overkill =)

-  rick




~|
Special thanks to the CF Community Suite Silver Sponsor - CFDynamics
http://www.cfdynamics.com

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186136
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


RE: copy directory

2004-12-03 Thread Martin Parry
Here's a piece of code I wrote to do just that.. Note There's a module
called act_make_folder - You just need to replace that with your own
code to make the destination folder. Call it as a Customtag or CFModule
passing the source and destination.

Martin Parry
http://www.beetrootstreet.com

cfparam name=Attributes.Source
cfparam name=Attributes.Destination
cfparam name=Attributes.Recurse default=False
cfparam name=Attributes.OverWrite default=True
cfparam name=Attributes.Filter default=*

cfif right(Attributes.Source, 1) is not /
cfset Attributes.Source = Attributes.Source  /
/cfif

cfif right(Attributes.Destination, 1) is not /
cfset Attributes.Destination = Attributes.Destination  /
/cfif
cfdirectory action=LIST directory=#Attributes.Source#
name=myDirectory filter=#Attributes.Filter# 

cfmodule template=act_make_folder.cfm
folder=#Attributes.Destination#

cfloop query=myDirectory
cfif myDirectory.name is not . AND myDirectory.name is not
..
cfswitch expression=#myDirectory.Type#

cfcase value=dir
!--- If recurse is on, move down to
next level and copy that folder ---
cfif attributes.Recurse
cfmodule
template=act_copy_folder.cfm
source=#Attributes.Source##myDirectory.Name#
Destination=#Attributes.Destination##myDirectory.Name#
Recurse=#Attributes.Recurse# OverWrite=#Attributes.OverWrite#
/cfif
/cfcase

cfcase value=file
!--- Copy file ---
cfset DoCopy = True

cfif NOT Attributes.OverWrite AND
fileExists(#Attributes.Destination##myDirectory.Name#)
cfset DoCopy = False
/cfif
cfif DoCopy
cffile action=COPY
source=#Attributes.Source##myDirectory.Name#
destination=#Attributes.Destination##myDirectory.Name#
/cfif
/cfcase   
/cfswitch
/cfif
/cfloop

-Original Message-
From: Rick Root [mailto:[EMAIL PROTECTED] 
Sent: 03 December 2004 17:34
To: CF-Talk
Subject: copy directory

Is it possible to copy a directory and all its contents without using 
cfexecute?



~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186187
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Re: copy directory

2004-12-03 Thread Rick Root
Martin Parry wrote:

 Here's a piece of code I wrote to do just that.. Note There's a module
 called act_make_folder - You just need to replace that with your own
 code to make the destination folder. Call it as a Customtag or CFModule
 passing the source and destination.

Martin, that's great.. that was very helpful.  Your code copies the 
contents of a source directory to a desintation directory.  My goal was 
to copy the actual directory AND its contents...

I re-wrote your code as a UDF, and added a parameter that actually 
allows the same function to accomplish both goals.  By default, it will 
copy the directory AND its contents to an existing destination directory...

The rewritten code is available here:

http://www.webworksllc.com/lib/copyDirectory.txt

If anyone wants it... maybe I should submit it to cflib since there is 
no such function on there right now that I could find.

  - Rick


~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186199
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Re: copy directory

2004-12-03 Thread Rick Root
For what it's worth, I also wrote a deleteDirectory() UDF that deletes a 
directory and all its contents, based on the same code.

Thanks a ton, Martin!

http://www.webworksllc.com/lib/copyDirectory.txt
http://www.webworksllc.com/lib/deleteDirectory.txt

  - Rick

~|
Special thanks to the CF Community Suite Silver Sponsor - CFDynamics
http://www.cfdynamics.com

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186201
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Re: copy directory

2004-12-03 Thread Rick Root
For what it's worth, I also wrote a deleteDirectory() UDF that deletes a 
directory and all its contents, based on the same code.

Thanks a ton, Martin!

http://www.webworksllc.com/lib/copyDirectory.txt
http://www.webworksllc.com/lib/deleteDirectory.txt

  - Rick

~|
Special thanks to the CF Community Suite Silver Sponsor - CFDynamics
http://www.cfdynamics.com

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186202
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


RE: copy directory

2004-12-03 Thread Martin Parry
That's great Rick - I'm glad it was useful (BTW - It's Martin Parry not
Perry ;)

Why not put it on CFLIB - I'm sure it'd save lots of other users the
same paind.

Cheers

Martin

-Original Message-
From: Rick Root [mailto:[EMAIL PROTECTED] 
Sent: 04 December 2004 03:01
To: CF-Talk
Subject: Re: copy directory

For what it's worth, I also wrote a deleteDirectory() UDF that deletes a

directory and all its contents, based on the same code.

Thanks a ton, Martin!

http://www.webworksllc.com/lib/copyDirectory.txt
http://www.webworksllc.com/lib/deleteDirectory.txt

  - Rick



~|
Special thanks to the CF Community Suite Silver Sponsor - CFDynamics
http://www.cfdynamics.com

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186204
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54