The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages - More
> ColdFusion Development
|
Pass a Directory Query to <cfzip>?
Discuss Pass a Directory Query to <cfzip>? in the ColdFusion Development forum on Dev Shed. Pass a Directory Query to <cfzip>? ColdFusion Development forum discussing CFML coding practices, tips on CFML, and other CFML related topics. Find out why ColdFusion is the tool of choice for many e-commerce developers.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

April 22nd, 2011, 03:15 PM
|
|
Registered User
|
|
Join Date: Apr 2011
Posts: 3
Time spent in forums: 39 m 3 sec
Reputation Power: 0
|
|
|
Pass a Directory Query to <cfzip>?
I'm cross-posting this from Stackoverflow because CF questions don't seem to be answered quite as often over there. I can't create a direct link to it because this is a brand new account, but I'd be happy to PM the URL to anyone who wants to see the question on SO. The following is a direct copy-paste from the question:
I need to zip files from a directory, but not all the files in the directory. I determine the files that need to be zipped by running a query on the directory listing.
Currently, I'm looping over the query results to add each file to the archive individually, but this can take a while in a large directory.
Is there any way to do this outside of a loop? I couldn't find anything in the CF docs that would indicate that you can pass some sort of list to cfzip.
|

April 22nd, 2011, 04:02 PM
|
|
Moderator
|
|
Join Date: Jun 2002
Location: Raleigh, NC
|
|
|
Yes, you can use a directory as the source and specify a filter.
|

April 22nd, 2011, 06:56 PM
|
|
Registered User
|
|
Join Date: Apr 2011
Posts: 3
Time spent in forums: 39 m 3 sec
Reputation Power: 0
|
|
|
Sorry, I should have been more specific in my question. I need all files in the folder that have a last modified date greater than a date that I am passing as a parameter. Is that passable as a filter? It seemed like filters were for the purpose of zipping files with a specific naming convention or files of the same type.
|

April 23rd, 2011, 09:58 AM
|
|
Moderator
|
|
Join Date: Jun 2002
Location: Raleigh, NC
|
|
|
You can specify a list of filter values, but if the list is very large that probably won't work. It might be worth seeing if it is faster to loop over the files and copy or temporarily move them to a temp folder, and then just zip the temp folder. Finally, move them back to their original location (if you didn't copy them).
|

April 24th, 2011, 11:40 PM
|
|
Registered User
|
|
Join Date: Apr 2011
Posts: 3
Time spent in forums: 39 m 3 sec
Reputation Power: 0
|
|
|
Thanks, I did find it much faster to copy the files to a temp directory rather than calling cfzip 100+ times in a loop.
Appreciate it!
|

May 18th, 2011, 03:56 AM
|
|
Registered User
|
|
Join Date: May 2011
Posts: 1
Time spent in forums: 29 m 10 sec
Reputation Power: 0
|
|
|
Zhao compares China's social reality to an apple: it is much better, he says, to give the whole fruit to a foreigner when presenting China rather than just apple jam, juice or even vitamin C.
"Foreigners can bite and taste the apple by themselves, and it gives them room to digest and ponder it."
Zhao said he wants to explain and write on China in an easy and understandable way even high school students can get it. "Tell them ABC, not XYZ."
Over the past few decades, Zhao has left no stone unturned chumming up to foreign counterparts and impressing them with his soundbites.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|