As @andreascreten, wp-cli will do the job for you.
wp-cli includes commands for W3TC (located in the src/php/wp-cli/commands/community/total-cache.php
file), so you can flush the cache by running:
$ wp total-cache flush <type>
Where <type>
is one of ‘db’, ‘minify’, ‘object’, ‘page’ or ‘post’.
(Note: If you use ‘post’, you’ll need to pass in --post_id=
or --permalink=
as well)