0

ファイルを処理して特定のフォルダーに配置するスクリプトがあります。その一部があります:

 String.prototype.repeat = function(n)
            {
                return new Array( n + 1 ).join(this);
            }

            //WScript.Echo("JScript");

            var fields = new Array ();
            var fso = new ActiveXObject("Scripting.FileSystemObject");
            file_name = "C:\\SOURCE_FILE\\ext"; //Source folder + file name     
            var file_in = fso.OpenTextFile(file_name + ".dat", 1, false);       //file for processing
            file_name_out = "C:\\DEST_DIR\\ext";    //folder for result file + file profix  


    // create sToday wich I want to use in folder creation and for concatenaiting to file
    var today = new Date();
    var CurrentMonth = (today.getMonth()+1);
    var CurrentDay = (today.getDay());
    if (CurrentDay<10)
    var sToday = "0"+today.getDate().toString();
    else 
    var sToday = today.getDate().toString();
    if(CurrentMonth<10)
    sToday += "0";
    else 
    sToday += "";
    sToday += (today.getMonth()+1).toString();
    sToday += today.getYear().toString();
    //sToday += today.getHours().toString();
    //sToday += today.getMinutes().toString();
    //sToday += today.getSeconds().toString();

dest_dir = "C:\\DEST_DIR\\"+sToday; //Here I am trying to crate a folder like timestamp, but it does not work =(((  
            var file_xml = fso.OpenTextFile(dest_dir + sToday + ".dat", 2, true);   //result file 
            var log = fso.OpenTextFile(file_name_out + sToday + "_log.txt", 2, true);       //log file

だから、誰かがタイムスタンプのようなフォルダを「C:\DEST_DIR\」に作成するのを手伝ってくれませんか。

4

1 に答える 1

0

試してみてくださいFileSystemObject.CreateFolder

dest_dir = "C:\\DEST_DIR\\" + sToday;
fso.CreateFolder(dest_dir);
于 2012-04-13T12:11:06.063 に答える