Always something new to find in Railo

Even for myself this was absolutely stunning. I decided to write a series of tips for Railo and by doing this I stumbled across a problem Andrea Campolonghi had, who writes the Railo AJAX tag extensions we will include very soon. The problem was or is that he needed to read the content of a zip file that is inside another zip archive. Now how to do that without unzipping it into a local folder.

So here's problem and the solution (I must say I was very astonished that it worked, but somehow it seemed logical as well):

<cfdirectory action="list" name="getFiles" directory="zip://d:\myzipfile.zip!content.zip" recurse="true">

This fails with the following error:
file [d:\myzipfile.zip!content.zip] exists, but isn't a directory
So what to do?
Well this is the solution:

<cffile action="copy" source="zip://d:\myzipfile.zip!content.zip" destination="ram://content.zip">
<cfdirectory action="list" name="getFiles" directory="zip://ram://content.zip" recurse="true">
<cfdump eval=getFiles>
<cffile action="delete" file="ram://content.zip">

So I combine the RAM and the ZIP resource in one directory address. You can only combine different resources in order to use them at the same time. I think that's really cool!

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
BlogCFC was created by Raymond Camden. This blog is running version 5.9.1.002. Contact Blog Owner