The directory php-5.2.5/ is obtained by bzip2 -dc php-5.2.5.tar.bz2 | tar xvf - find php-5.2.5/ | grep -v "/tests/" | xargs rm -f cd php-5.2.5/; cleanlinks The first command unpack the php-5.2.5 source package. The second command removes any files that do not have "/tests" in their paths. The assumption is that all the test files (.phpt files and test data files) must have "/tests/" in their paths. The third step uses the program cleanlinks to remove dangling symbolic links and empty directories. This leaves us perhaps with a little more than necessary for hphp testing but we won't miss any.