I don’t know whether there is a better WP-CLI way or not, but you could write a simple script that recursively crawls your uploads directory (or it’s subdirectories) and than check the absolute paths (URLs) of those files and compare them against guid column in wp_posts table.
If your file is not there, WordPress doesn’t know about it and it probably can be deleted.
Related Posts:
- How can I batch delete all unattached images with WP-CLI or other automated process?
- Regenerate thumbnails unexpected resolution (96 x 96)
- How to add new tab to media upload manager with custom set of images?
- No Thumbnails Generated
- How to upload files straight to S3 without using local storage? [closed]
- Reject upload of wrong-sized images using the Media Uploader
- WordPress Media Uploader events
- How to add a custom field to the media screen (image/gallery)?
- Users can’t upload images on frontend if they haven’t got access to the wp backend
- Get an uploaded attachments local server path?
- Change WordPress upload path and URL
- Send attachments via wp_mail from temporary folder
- Large Uploads in WordPress
- can not upload file .vtt on wordpress 5.0.1
- Refresh wp.media after ajax call
- User logged-in from front end is logged out automatically accessing wp-admin
- wp_editor with media buttons
- How to prevent upload of a multiple sizes of images
- Using “media_handle_sideload” to upload images programmatically does not upload image to Media Library
- Convert uploaded PNG to JPEG automatically
- How to check if an image attachment exists before uploading
- Using attachment_fields_to_edit filter inside plugin class
- Add new media uploader at frontend for wp 3.5+
- Incremental number handling on duplicate file names
- wp_temp_dir does not change the /tmp temporary default directory
- Maximum upload size changes in php.ini ignored – How to remove upload size limit?
- How to upload all media to one folder, with no year/month subfolders
- Any way to define WP_UPLOADS_URL (like WP_CONTENT_URL)?
- Regenerate thumbnails after upload
- Media library storing files in uploads not folders within in uploads
- upload files dynamically to user folders
- How to protect media directory with .htaccess?
- Is there a limit on the number of attachments?
- ACF attachment custom field in rest response
- How to delete uploads not in media library?
- How to decrease the file size upload limit?
- media_handle_upload : undefined function?
- Site icons with alpha channel for self-hosted WordPress blog network
- How can I allow upload of ttf or otf font files when hooking `upload_mimes` doesn’t work
- I made a website using WordPress, but the server is ColdFusion, how can I make it work?
- Using subdomain to upload media/images etc on 2 different blogs
- Unable to create directory uploads/2018/12. Is its parent directory writable by the server?
- Can I upload a file to the site so that it is not accessible via an HTML page?
- Calling WP Gallery Uploader/Selector From Metabox
- why am i getting the ‘fatal error’ msg when uploading photos within specified MB?
- Disable image thumbnails for only one upload folder
- Media library only shows for admin. Doesn’t show editor or below [closed]
- Upload featured image from front end using media-upload.php
- Get File Object from wp.Uploader
- media_handle_sideload on a file already on server
- Capability to prevent upload of files
- wp_handle_upload: get custom checkbox value from media uploader
- Edit User Profile From Front End
- How can I upload to wp media library by foundation zurb ajax
- Disable new WP3.5 Media Picker
- User permissions to upload images
- Why is WordPress’ file upload limit so low? Is changing it harmful?
- How to get the uploaded image url in media_handle_upload()?
- How to change format of file link ( Name ) when insert from media uploder
- Using dashboard uploader instead of FTP
- Use wp_handle_upload outside of a POST
- Moving Existing images from custom directory to WP’s upload directory
- Website does not reflect changes on live after uploading files via FTP
- admin notice on Insert Media popup screen
- How to allow .bin files upload?
- Programmatically Upload File to WordPress Using an API [closed]
- Add SWF file to wordpress through custom template
- Uploading flash flipbook to mu wordpress site
- Uploaded images result in a file url with full path on disk appended
- Change Link to Upload folder
- Migrating WordPress Uploads To S3 Object Storage
- Upload Video using wordpress rest api with ionic
- download images from wp-content/uploads/year/month/DSC_123.jpg
- Which wordpress action fires after crunching
- Workaround to upload AVIF files
- Missing a temporary folder not fixed
- How to allow .xls file uploads?
- Upload automatically html files
- Updating the attachment from front end doesn’t show the new change
- Bulk upload images in upload folder does not show in media library
- Is there some way to find if media items are used anywhere on the site?
- wp_update_attachment_metadata breaks after 10 files
- Media URL slugs without uploads folder path
- Add more field on WordPress media upload
- Frontend media shows “An error occurred in the upload. Please try again later.”
- File Upload Management
- WP_Custom_Media_Control | Give ID to media file
- WP Add Media Button – Can I set the default size to Original/Full Size
- Video limit about wordpress
- Can i add flickr,imgur etc. up-loader for my WP upload media button?
- Files larger than 500 kilobytes are not allowed
- How to split my uploaded media into directories?
- get the post thumbnail returns the full size
- WordPress media upload multiple images
- Media Upload Directory to MMYY instead of YYYY/MM
- Is there a way to force Featured image to show as attachement?
- Auto-Import of WXR File
- Media upload takes too long
- Problems with defining UPLOADS constant
- Create media folder upon post publish?