Starting from release 3.26.4, you can do this directly from the user interface.
You’ll find the option under Settings > Remove Legacy Views.
Of course, any views that are pinned or used in notifications or reports will not be removed.
The modal will show you how many views are going to be deleted.
This may also help improve the system’s performance a bit.