var tmpPart: String; Begin (* BBL folder1 ABB folder2 BYR folder4 BYP folder5 DAT folder6 *) psExitCode:= 1; psVSA := ''; // ... add your code here tmpPart := copy(psFileName, 1, 3); If SameText('BBL', tmpPart) then psVSA := 'folder1'; If SameText('ABB', tmpPart) then psVSA := 'folder2'; If SameText('BYR', tmpPart) then psVSA := 'folder4'; If SameText('BYP', tmpPart) then psVSA := 'folder5'; If SameText('DAT', tmpPart) then psVSA := 'folder6'; End.