プログラムも非常に単純で、ローカル ディレクトリを走査して、大量の FTP コマンドを生成するだけです。
{
var s;
var re = /200d{5}/ig;
s = strFolderName.match(re);
返品;
}
関数 init()
{
strScript ="open 192.168.1.32 n";
strScript ="ユーザー sybase 111111 n";
strScript ="binn";
strScript ="プロンプトn";
strScript ="cd /hisdata/olddata n";
dicWhiteList = new ActiveXObject("Scripting.Dictionary");
dicWhiteList.add ("20051205_pihou", "");
dicWhiteList.add ("20051206_pihou", "");
dicWhiteList.add ("20060701_pihou", "");
}
関数 EnumSubFolder(oSubFolder)
{
var eFolders=new Enumerator(oSubFolder.SubFolders);
var s="";
if(eFolders.atEnd())
{
return s;
}
その他
{
for (; !eFolders.atEnd(); eFolders.moveNext())
{
s ="lcd "";
s =eFolders.item();
s=""n";
s ="mput *.*n";
}
return s;
}
}
関数 checkList(strToBeChecked)
{
return !dicWhiteList.Exists(strToBeChecked);
}
var strScript,dicWhitList;
var sFolderPath="e:\";
var oFs=new ActiveXObject("Scripting.FileSystemObject");
init();
if (oFs.FolderExists(sFolderPath))
{
//WScript.Echo("有効なフォルダー");
var oFolders=oFs.GetFolder(sFolderPath);
var eFolders=new Enumerator(oFolders.SubFolders);
if(eFolders.atEnd())
{
strScript = "mkdir "";
strScript = oFs.GetBaseName(sFolderPath);
strScript = ""n";
}
その他
{
for (; !eFolders.atEnd(); eFolders.moveNext())
{
strTargetFolderName=matchDemo(eFolders.item() "");
if(strTargetFolderName==null|| checkList(oFs.GetBaseName(eFolders.item())))
続行
strTmpFolderName=""" oFs.GetBaseName(eFolders.item()) """;
strScript = "mkdir"
strScript = strTargetFolderName;
strScript = "n";
strScript = "cd ";
strScript = strTargetFolderName;
strScript = "n";
strScript = EnumSubFolder(eFolders.item());
strScript = "lcd "strScript = eFolders.item();
strScript = "n";
strScript = "mput *.*n";
strScript = "cd nlcd n";
}
}
strScript ="byen";
WScript.Echo(strScript);
}
その他
{
WScript.Echo("不正なフォルダー名");
}