또한 이 프로그램은 매우 간단합니다. 로컬 디렉터리를 탐색한 다음 여러 ftp 명령을 생성하기만 하면 됩니다.
{
vars;
var re = /200d{5}/ig;
s = strFolderName.match(re);
반품;
}
함수 초기화()
{
strScript ="open 192.168.1.32 n";
strScript ="사용자 sybase 111111 n";
strScript ="binn";
strScript ="프롬프트";
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())
{
반품;
}
그밖에
{
(; !eFolders.atEnd(); eFolders.moveNext())
{
s ="lcd "";
s =eFolders.item();
s=""n";
s ="mput *.*n";
}
반품;
}
}
함수 checkList(strToBeChecked)
{
return !dicWhiteList.Exists(strToBeChecked);
}
var strScript,dicWhitList;
var sFolderPath="e:\";
var oFs=new ActiveXObject("Scripting.FileSystemObject");
초기화();
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";
}
그밖에
{
(; !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("잘못된 폴더 이름");
}