// // getdir.vdm Christian Ziemski 10.08.2004 // // Simple template macro to read in a directory listing (files only) // and to process it then. // // Example for Patrick Carroll // //------------------------------------------------------------------ // Open a temporary working file and empty it if needed File_Open("|(VEDIT_TEMP)\getdir.tmp", NOMSG+NOEVENT) Del_Block(0, File_Size) ChDir("D:\xxx") // change into your data directory // do a directory listing and redirect it into the current file Out_Ins() Dir("*.*", NOMSG+SUPPRESS) Out_Ins(CLEAR) // process the listing // // "IL03 016s 10w_001.jpg" should be renamed to "IL03 016s 010w_001.jpg" // "IL03 025n 015e_001.jpg" should remain untouched Begin_Of_File while ( ! At_EoF ) { // search in current line for the sequence: // letter, space, two digits, letter w or e, underscore Search_Block("|A |D|D|{w,e}_", Cur_Pos, EoL_Pos, NOERR) if ( ! Error_Match) { // if found Reg_Copy_Block(103, BoL_Pos, EoL_Pos) // remember filename Reg_Copy_Block(104, BoL_Pos, BoL_Pos+10) // build the target name Reg_Set(104, "0", APPEND) Reg_Copy_Block(104, BoL_Pos+10, EoL_Pos, APPEND) // for testing only: End_Of_Line Ins_Text(" -> ") Reg_Ins(104) // do it ... //File_Rename("|@(103)", "|@(104)") } Line(1) // next line in listing }