.7z
ColdFusion でファイルを抽出する関数を提案して、誰か助けてもらえますか? ColdFusion 10 と cfscript ベースのコードを使用しています。確かにタグはありますが、抽出してファイルcfzip
するだけです。.zip
.jar
2 に答える
4
cfexecute
残念ながら では利用できない を使用しcfscript
て、サーバー上で 7z エクストラクタを実行し、さまざまなコマンドを実行して、選択した場所にファイルを抽出できます。
幸いなことに、Raymond Camden が詳しく説明しているようです。
http://www.raymondcamden.com/index.cfm/2011/2/21/Working-with-RARs-in-ColdFusion
于 2013-05-31T12:57:34.733 に答える
0
指定された宛先で .rar ファイルを unrar する機能.. cfexecute タグを使用して、コマンド ラインで rar exe を実行します。
<cffunction name="Unrar" access="public" returnType="boolean" output="false">
<cfargument name="archivefile" type="string" required="true">
<cfargument name="destination" type="string" required="true">
<cfset var exeName = "">
<cfset var result = "">
<cfset var errorresult = "">
<cfif not fileExists(arguments.archivefile)>
<cfthrow message="Unable to work with #arguments.arvhiefile#, it does not exist.">
</cfif>
<cfif findnocase(".rar",arguments.archivefile)>
<cfset var exeName = expandpath("WinRAR\rar.exe")>
<cfset var args = []>
<cfif directoryExists(#arguments.destination#)>
<cfset args[1] = "x +o">
<cfelse>
<cfset directoryCreate(#arguments.destination#)>
<cfset args[1] = "x">
</cfif>
<cfset args[2] = arguments.archivefile>
<cfset args[3] = "#arguments.destination#">
</cfif>
<cfexecute name="#exeName#" arguments="#args#" variable="result" errorvariable="errorresult" timeout="99" />
<cfif findNoCase("OK All OK", result)>
<cfreturn true>
<cfelse>
<cfreturn false>
</cfif>
</cffunction>
于 2013-05-31T13:10:23.060 に答える