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 回答