- @if(0)==(0) echo off
- dir /b /s *.txt *.Log | cscript //nologo //e:jscript "%~f0"
- pause & goto :EOF
- @end
-
- var dstFolder = 'E:\\Test\\'; //移动到 E:\Test 目录
- //var dstFolder = WSH.ScriptFullName.replace(/[^\\]+$/, '');
- var fso = new ActiveXObject('Scripting.FileSystemObject');
-
- while(!WSH.StdIn.AtEndOfStream){
- var strFile = WSH.StdIn.ReadLine();
- var objFile = fso.OpenTextFile(strFile, 1);
- var str = objFile.ReadAll();
- objFile.Close();
- var m1 = str.match(/^[^\r\n]*\r?\n&REL 847/i);
- var m2 = str.match(/^;\*.*: *(\D+)(\d+)([^(]+)\(/m);
- if(!m2) continue;
- var fd = dstFolder + m2[1] + '\\' + m2[1]+m2[2] + '\\' + m2[1]+m2[2]+m2[3]+ '\\' + (m1 ? 'YES' : 'NO');
- createFolder(fd.toUpperCase());
- var name = strFile.replace(/.*\\/, '');
- if(!fso.FileExists(fd + '\\' + name)) fso.getFile(strFile).Move(fd + '\\');
- }
-
- function createFolder(strFolder) {
- var arr = strFolder.split('\\');
- var fd = arr[0];
- for(var i=1; i<arr.length; i++) {
- fd += '\\' + arr[i];
- if(!fso.FolderExists(fd)) fso.CreateFolder(fd);
- }
- }
复制代码
|