Remove all old flow versions using SFDX

From my tests in api version 46 (Summer'19), it seems the procedure described here still works despite sfdx handling flows differently since api version 43.

  1. Find the version numbers of the flow you want to delete by querying FlowDefinitionView

  2. pack them all into your destructiveChanges.xml which will look something like this:

    <?xml version="1.0" encoding="UTF-8"?>
        <Package xmlns="http://soap.sforce.com/2006/04/metadata">
          <types>
            <members>Process_To_Delete-2</members>
            <members>Process_To_Delete-1</members>
            <name>Flow</name>
          </types>
          <version>46.0</version>
        </Package>
    
  3. use the sfdx force:mdapi:deploy -d packageLocation to deploy the deletion

  4. deploy the version of the flow you want to keep

Note: The new way of handling flows since api version 43 means you should technically just put <members>Process_To_Delete</members> but this will systematically give you a insufficient access rights on cross-reference id as will the sfdx force:source:delete command.

Edit So far, it doesn't seem possible to do this with an sfdx command, since only the metadata api allows deleting flow versions.