ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 22nd, 2011, 03:15 PM
s992 s992 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2011
Posts: 3 s992 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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.

Reply With Quote
  #2  
Old April 22nd, 2011, 04:02 PM
kiteless kiteless is offline
Moderator
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 5,091 kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 2 h 53 m 27 sec
Reputation Power: 966
Yes, you can use a directory as the source and specify a filter.

Reply With Quote
  #3  
Old April 22nd, 2011, 06:56 PM
s992 s992 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2011
Posts: 3 s992 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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.

Reply With Quote
  #4  
Old April 23rd, 2011, 09:58 AM
kiteless kiteless is offline
Moderator
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 5,091 kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 2 h 53 m 27 sec
Reputation Power: 966
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).

Reply With Quote
  #5  
Old April 24th, 2011, 11:40 PM
s992 s992 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2011
Posts: 3 s992 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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!

Reply With Quote
  #6  
Old May 18th, 2011, 03:56 AM
kinah00 kinah00 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2011
Posts: 1 kinah00 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Pass a Directory Query to <cfzip>?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap