The two-band discrete wavelet transform (DWT) provides an octave-band analysis in the frequency domain, but this might not be "optimal" for a given signal. The discrete wavelet packet transform (DWPT) provides a dictionary of bases over which one can search for an optimal representation (without constraining the analysis to an octave-band one) for the signal at hand. However, it is well known that both the DWT and the DWPT are shift-varying. Also, when these transforms are extended to 2-D and higher dimensions using tensor products, they do not provide a geometrically oriented analysis. The dual-tree complex wavelet transform (DT-CWT), introduced by Kingsbury, is approximately shift-invariant and provides directional analysis in 2-D and higher dimensions. In this paper, we propose a method to implement a dual-tree complex wavelet packet transform (DT-CWPT), extending the DT-CWT as the DWPT extends the DWT. To find the best complex wavelet packet frame for a given signal, we adapt the basis selection algorithm by Coifman and Wickerhauser, providing a solution to the basis selection problem for the DT-CWPT. Lastly, we show how to extend the two-band DT-CWT to an M-band DT-CWT (provided that M = 2(b)) using the same method.