To delete the media files without leaving traces in the database, do the following:
- Connect to the mysql database - using phpmyadmin, for example - and run the following queries:
DELETE FROM wp_postmeta WHERE post_id IN ( SELECT id FROM wp_posts WHERE post_type = 'attachment' ) ; DELETE FROM wp_posts WHERE post_type = 'attachment'; - Delete the files and folders stored in ./wp-content/uploads/