Delete Media not attached with Any posts

You can also do this direclty from your WordPress Dashboard. Login to your website and go to media for the same.

In the media, select list view and filter the media which are Unattached to the post. Once you get the filtered media items, select all items and delete the same using Bulk Actions.

The same thing is also shown in below attached image.
Unattached Media in WordPress