To select actions for out of stock products, go to
External Importer > Settings > Synchronization.
By default, WordPress doesn't delete attached files from the media library when a product is deleted. You can enable the option '
Delete attached media' to delete images and galleries automatically. Make sure you don't use these media resources in other posts or for other products.
You can check the current status for the External type only on the product edit page.