You can also retrieve the size of the file via size and human_readable_size :
$mediaItems->size; // Returns the size in bytes
$mediaItems->human_readable_size; // Returns the size in a human readable format (eg. 1,5 MB)
An instance of Media also contains the mime type of the file.
$mediaItems->mime_type; // Returns the mime type
You can remove something from the library by simply calling delete on an instance of Media:
When a Media instance gets deleted all related files will be removed from the filesystem.
Deleting a model with associated media, will also delete all associated files.
$newsItem->delete(); // all associated files will be deleted as well
If you want to remove all associated media in a specific collection you can use the clearMediaCollection method. It also accepts the collection name as an optional parameter:
$newsItem->clearMediaCollection(); // all media will be deleted
$newsItem->clearMediaCollection('images'); // all media in the images collection will be deleted
Also, there is a clearMediaCollectionExcept method which can be useful if you want to remove only few or some selected media in a collection. It accepts the collection name as the first argument and the media instance or collection of media instances which should not be removed as the second argument:
$newsItem->clearMediaCollectionExcept('images', $newsItem->getFirstMedia()); // This will remove all associated media in the 'images' collection except the first media