2006年09月11日

 圧縮から FTP アップロード




本体 : WSF
圧縮 : BatchHelper オブジェクト
FTPアップロード : PHP


<JOB>
<COMMENT>
************************************************************
 標準的なオブジェクトを作成
************************************************************
</COMMENT>
<OBJECT id="WshShell" progid="WScript.Shell" />
<OBJECT id="Fso" progid="Scripting.FileSystemObject" />
<OBJECT id="Dic" progid="Scripting.Dictionary" />
<OBJECT id="Shell" progid="Shell.Application" />
<OBJECT id="Outer" progid="Lbox.OuterDll" />

<SCRIPT language=VBScript>
' ***********************************************************
' 処理開始
' ***********************************************************

strCurDir = WshShell.CurrentDirectory & "\"
strTarget = strCurDir & "gen_euc.lzh"

on error resume next
Call Fso.DeleteFile( strTarget )
on error goto 0

strTargetList = strCurDir & "gen.php"
strTargetList = strTargetList & vbTab & strCurDir & "gen.mkp"
strTargetList = strTargetList & vbTab & strCurDir & "parts"

Call Outer.FreezeLzh( strTarget, strTargetList ) 

Call WshShell.Run( "cmd.exe /c gen_euc.bat", , True )

</SCRIPT>
</JOB>

set PHP_BIN=c:\php\cli\php.exe
%PHP_BIN% gen_euc_ftp.php

pause

<?
$ftp_server="****************"; 
$ftp_user="****************"; 
$ftp_pass="****************"; 
$base_dir = "/home/lightbox/www/homepage/download";
$local_dir = "D:\\sakura\\homepage\\php\\webappgen\\060909";

$conn=ftp_connect($ftp_server);
if (!$conn) {
	die('接続できません' . "\n");
}

$result=@ftp_login($conn, $ftp_user, $ftp_pass); 
if (!$result) {
	die('ログインできません' . "\n");
}

ftp_pasv($conn, true);

$ret = ftp_put($conn, $base_dir . "/gen_euc.lzh", $local_dir . "\\gen_euc.lzh", FTP_BINARY );

if ( $ret === TRUE ) {
	print "成功\n";
}
else {
	print "失敗\n";
	print $base_dir . "/gen_euc.lzh\n";
	print $local_dir . "\gen_euc.lzh\n";
}

ftp_close($conn);

print "処理が終了しました\n";
?>