var now = new Date();
var year = now.getYear(); // 年
var month = now.getMonth() + 1; // 月
var day = now.getDate(); // 日
var hour = now.getHours(); // 時
var min = now.getMinutes(); // 分
var sec = now.getSeconds(); // 秒
if(year < 2000) { year += 1900; }
// 数値が1桁の場合、頭に0を付けて2桁で表示する指定
if(month < 10) { month = "0" + month; }
if(day < 10) { day = "0" + day; }
if(hour < 10) { hour = "0" + hour; }
if(min < 10) { min = "0" + min; }
if(sec < 10) { sec = "0" + sec; }
var batRcopyDir = "c:\\aeBat\\rcopy\\";
var dateDir = year +"_"+ month + "_" + day;
var curTime = hour + "_" + min;
Folder(batRcopyDir + dateDir).create();
//rcopyのオプションとbatの変数
var copyOpt = '/S /TS /TEE /ETA /R:0 /XD old tmp temp *ログ /XF log.txt Thumbs.db /XO /NP /LOG+:C:%homepath%\\roboCopyLog\\%yy%%mm%%dd%\\log"_%tt%_%ff%_%bb%".txt';
var batTitle = "@title rcopyToX"
var batPause = "@pause"
var batYyyy = "@set yyyy=%date:~0,4%"
var batYy = "@set yy=%date:~2,2%"
var batMm = "@set mm=%date:~5,2%"
var batDd = "@set dd=%date:~8,2%"
var batTt = "@set tt=%time:~0,2%"
var batFf = "@set ff=%time:~3,2%"
var batBb = "@set bb=%time:~6,2%"
var batRcopyLogDir = '@mkdir C:%homepath%\\roboCopyLog\\%yy%%mm%%dd%'
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
var aepFullFileName = app.project.file.name;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
var batRcopyEnv = batTitle +" "+aepFullFileName +"_"+ "Footages" + "\n" + batPause + "\n" + batYyyy + "\n" + batYy + "\n" + batMm + "\n" + batDd + "\n" + batTt + "\n" + batFf + "\n" + batBb + "\n" + batRcopyLogDir;
alert (copyOpt);
alert (batRcopyEnv);
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
var rcopy = "robocopy";
var randnum = Math.floor( Math.random() * 100000 );
var aepFileName = aepFullFileName.replace(aepExtension,"")
var batRcopyFile = new File( batRcopyDir + dateDir + "\\"+ "rcopy" +"_" + aepFileName +"_" + curTime +"_"+ randnum + ".bat");
batRcopyFile.open("w");
batRcopyFile.writeln(batRcopyEnv)
// 置換対象文字列
var numItems = app.project.numItems;
//myArray = new Array(numItems);
for(i = 1; i <= numItems; i++) {
if(app.project.item(i).typeName == "フッテージ") {
if( !app.project.item(i) ) continue;
var cItem = app.project.item(i).file;
if( !cItem ) continue;
//alert (cItem);
var cItemPath = cItem.path;
var cItemName = cItem.name;
var cItemStr = String (cItem);
var cItemPathStr = String (cItemPath);
var cItemNameStr = String (cItemName);
// 置換処理
var cItemPathStr = cItemPathStr.replace(/\/y\//g, "y:\\");
var cItemPathStr = cItemPathStr.replace(/\//g, "\\");
var dFilePathStr = cItemPathStr.replace(/y:\\/g, "x:\\");
//alert (cItemPathStr);
//alert (dFilePathStr);
var copyFootage = (rcopy +" "+ cItemPathStr +" "+ dFilePathStr +" "+ copyOpt)
batRcopyFile.writeln(copyFootage)
}
}
batRcopyFile.writeln(batPause)
batRcopyFile.close();
batRcopyFile.execute();
0 件のコメント:
コメントを投稿