Generalise export command