I created the following efs to test out how to create Folders that have yet to be created (do not exist).
I looked for another post on the subject and could not find anything, so I thought I would post this example.
It works and creates multiple nested folders in the C:\Program Files\eSignal\FormulaOutput\ folder (provided that the default output folder has not been changed).
All of the new folders will be under the TRADEFILES Folder in the default output folder
I looked for another post on the subject and could not find anything, so I thought I would post this example.
It works and creates multiple nested folders in the C:\Program Files\eSignal\FormulaOutput\ folder (provided that the default output folder has not been changed).
All of the new folders will be under the TRADEFILES Folder in the default output folder
PHP Code:
var barcount = 0;
//note: Creates multiple nested Folders for use with efs output files in the following Folder
//C:\Program Files\eSignal\FormulaOutput\TRADEFILES
function preMain(){
}
function main(){
if (getCurrentBarIndex() < -1 )return;
sSymbol=sName();
var Strat_Names = new Array("Strategy1", "Strategy2", "Strategy3");
var x;
for (x=0; x<Strat_Names.length; x++) {
var f1 = new File("TRADEFILES");//creates requisite directories if not already there
if (!f1.exists())f1.mkDir();
var f1 = new File("TRADEFILES/"+sSymbol);//creates requisite directories if not already there
if (!f1.exists())f1.mkDir();
var f1 = new File("TRADEFILES/"+sSymbol+"/"+Strat_Names[x]);//creates requisite directories if not already there
if (!f1.exists())f1.mkDir();
var f1 = new File("TRADEFILES/"+sSymbol+"/"+Strat_Names[x]+"/utility data files");//creates requisite directories if not already there
if (!f1.exists())f1.mkDir();
var f1 = new File("TRADEFILES/"+sSymbol+"/"+Strat_Names[x]+"/trade records");//creates requisite directories if not already there
if (!f1.exists())f1.mkDir();
var f1 = new File("TRADEFILES/"+sSymbol+"/"+Strat_Names[x]+"/strategy data files");//creates requisite directories if not already there
if (!f1.exists())f1.mkDir();
}
}
function sName(){
var re1 = / /gi;
var re2 = /#/gi;
var re3 = /=/gi;
var tmpa = getSymbol();
tmpa=tmpa.replace(re1, "");
tmpa=tmpa.replace(re2, "");
tmpa=tmpa.replace(re3, "");
return tmpa;
}
Comment