Multi rename tool
Beküldte pzoli - 2011, május 27 - 5:43du
//regexp: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/js56jsgrpregexpsyntax.asp //példa a használatra: multirename " *\(.*\)" var fso; var objargs = WScript.Arguments; var vpath; function ShowFolderFileList(fso,pattern,replacestr,folderspec) { WScript.Echo(folderspec); //WScript.Echo(pattern+'/'+replacestr); var f, f1, fc, fname, idx; f = fso.GetFolder(folderspec); fc = new Enumerator(f.files); re = new RegExp(pattern,'ig'); for (; !fc.atEnd(); fc.moveNext()) { if (fc.item().name.match(re)) { fname=fc.item().name.replace(re,replacestr); fname=folderspec+'\\'+fname; fc.item().Move(fname); } } } fso = new ActiveXObject("Scripting.FileSystemObject"); // remote file system object // fso = new ActiveXObject("Scripting.FileSystemObject","192.168.1.2"); if (objargs.length==3) { if (fso.FolderExists(objargs(2))) vpath = objargs(2); else WScript.Echo('Útvonal elérhetetlen...'); } else if (objargs.length>=1) { var WshShell = WScript.CreateObject ("WScript.Shell"); vpath = WScript.CurrentDirectory; //ScriptFullName if (!vpath) vpath = fso.GetParentFolderName(WScript.ScriptFullName); } else WScript.Echo('Használat:\n '+fso.GetBaseName(WScript.ScriptName)+' <mit> <mire> [útvonal]'); if (vpath) ShowFolderFileList(fso,objargs(0),(objargs.length==1 ? '':objargs(1)),vpath);
- A hozzászóláshoz be kell jelentkezni