This is a slightly extended version of the official WP I18n tools which allows the exclusion of specified folders.
php path/to/makepot.php project-type path/to/source-folder/ path/to/pot-destination-folder/filename.pot [exclude-folder-1,exclude-folder-2,...]
The (optional) last parameter is a comma separated list of subfolders relative to the given source folder.
The most common project types are wp-theme and wp-plugin, further options are generic, wp-frontend, wp-admin, wp-network-admin, wp-core, wp-ms, wp-tz, bb, mu, bp, glotpress, rosetta and wporg-bb-forums.
GPLv2 or later