R2005 Vlisp: I need some help on how to code this part of my program. I am fairly new to Vlisp and have not learned all the polished techiques. I have a list of CNC plot files that I aquire with: [code] (setq PLTList (vl-directory-files "G:/SigmaNestLabels/" "*.PS" 1)) [/code] 4281_1.PS 4281_2.PS 4281_3.PS 4281_4.PS 4281_5.PS 4281_6.PS 4281_full.PS 4281_nest_1.PS 4281_nest_2.PS 4281_nest_3.PS 4282_1.PS 4282_2.PS 4282_3.PS 4282_4.PS 4282_5.PS 4282_full.PS 4282_nest_1.PS 4282_nest_2.PS 4282_nest_3.PS 4285_1.PS 4285_2.PS 4285_3.PS 4285_4.PS 4285_5.PS 4285_6.PS 4285_7.PS 4285_8.PS 4285_9.PS 4285_full.PS 4285_nest_1.PS 4285_nest_2.PS 4285_nest_3.PS Note in this sample list that each program number has four nest plots. #_full.ps, and one each of nest_1.ps, nest_2.ps and nest_3.ps. This covers the nest program part of the plots. Then each nest program has a number of parts plots. #_1.ps, #_2.ps, ect. (as many numbers as needed to plot all the parts). Now comes the trickey part. I need to duplex the 4 program nest plot files (4 each), to the parts plot files (first 4 of any number of parts plots). I am not having trouble with the duplexing,I have that down pat. I have to get #_1.ps duplexed with #_full.ps, #_2.ps duplexed with #_nest_1.ps ect. until all 4 nest plots are duplexed. This is what I have done so far (shown below), it works and I am satisfied so far: 1.) I get a sublist of each file name that begins with the same program # using: [code] (while PLTList (setq TMPList (vl-remove-if-not '(lambda (x)(= (substr x 1 4)(substr (car PLTList) 1 4))) PLTList) ;get same name list. PLTList (vl-remove-if '(lambda (x)(member x TMPList)) PLTList) ;remove from main list. ) [/code] This give me for example: Command: !tmplist ("4281_1.PS" "4281_2.PS" "4281_3.PS" "4281_4.PS" "4281_5.PS" "4281_6.PS" "4281_full.PS" "4281_nest_1.PS" "4281_nest_2.PS" "4281_nest_3.PS") I hope I have explained this clearly so far. This next part is what I am not too happy with, although it works, I am looking for a more elegant way. :) 2.) From TMPList (which is all matching nest numbers), I need to extract the filenames that get duplexed. [code] (setq FileNa (substr (car TMPList) 1 4) ;program name incase I need to create a blank file for nest. FullNest (car (vl-remove-if-not '(lambda (x)(wcmatch x "*full*")) TMPList)) ;First Nest plot. TMPList (vl-remove-if '(lambda (x)(wcmatch x "*full*")) TMPList) ;trim TMPlist of item. Nest_2 (car (vl-remove-if-not '(lambda (x)(wcmatch x "*nest_1*")) TMPList)) ;partial nest (3 part). TMPList (vl-remove-if '(lambda (x)(wcmatch x "*nest_1*")) TMPList) Nest_3 (car (vl-remove-if-not '(lambda (x)(wcmatch x "*nest_2*")) TMPList)) TMPList (vl-remove-if '(lambda (x)(wcmatch x "*nest_2*")) TMPList) Nest_4 (car (vl-remove-if-not '(lambda (x)(wcmatch x "*nest_3*")) TMPList)) TMPList (vl-remove-if '(lambda (x)(wcmatch x "*nest_3*")) TMPList) Plot_1 (car (vl-remove-if-not '(lambda (x)(= (substr x 6 1) "1")) TMPList)) TMPList (vl-remove-if '(lambda (x)(= (substr x 6 1) "1")) TMPList) Plot_2 (car (vl-remove-if-not '(lambda (x)(= (substr x 6 1) "2")) TMPList)) TMPList (vl-remove-if '(lambda (x)(= (substr x 6 1) "2")) TMPList) Plot_3 (car (vl-remove-if-not '(lambda (x)(= (substr x 6 1) "3")) TMPList)) TMPList (vl-remove-if '(lambda (x)(= (substr x 6 1) "3")) TMPList) Plot_4 (car (vl-remove-if-not '(lambda (x)(= (substr x 6 1) "4")) TMPList)) TMPList (vl-remove-if '(lambda (x)(= (substr x 6 1) "4")) TMPList) MoveList (cons TMPList MoveList) ;any files left over that are not duplexed that get moved to server. ) [/code] Keep in mind that the code has to be flexible enough so that if there is not a part #_3 or #_4 file, it does not crash (right now it just returns nil for that item). Just looking for some expertise on hadeling this part of my code. What I do after this, using these variable names, works okay too: [code] (if (and (findfile (strcat "G:/SigmaNestLabels/" FullNest)) (findfile (strcat "G:/SigmaNestLabels/" Plot_1)) ) (progn (Duplex (strcat "G:\SigmaNestLabels\" Plot_1)(strcat "G:\SigmaNestLabels\" FullNest)) ;duplex (setq MoveList (apply 'append MoveList)) ;move this file list to server. [/code] TIA Bill