I moved some files from one directory to another in my server. I would like to zip the destination folder after moving the files.
<cfoutput>
<cfset destination = expandPath("./TenantFiles/tempEmail/11/") />
<cfif not directoryExists(destination)>
<cfdirectory action="create" directory="#destination#">
<cfelse>
<cfdirectory action="delete" directory="#destination#" recurse="true">
<cfdirectory action="create" directory="#destination#">
</cfif>
<cfloop query="myQuery">
<cfset sourcefile = expandPath("./TenantFiles/11/#myQuery.TenantID#/#myQuery.DocumentName#") />
<cfif FileExists(sourcefile)>
<cfscript>
FileMove(#sourcefile#, #destination#);
</cfscript>
</cfif>
</cfloop>
<cfzip action="zip" file="#destination#\ZipFile.zip" source="#destination#" filter="*.pdf" />
</cfoutput>
It is returning the error:
Can not create a zip file with no entries.
Make sure that there is at least one entry in the zip file.
However the #destination#
folder has a lot of pdf files.
Thanks