Get all WordPress-created sub folders in uploads directory

You can use this WP function wp_get_upload_dir to know the uploads directory path.
Please note different website can choose not to use “year/month” fashion folder structure so using this function we will be advisable.

And then for finding all webp file you can use FileSearchIterator of PHP

$fileScanner = new FileSearchIterator( UPLOAD_BASE_PATH, true, 
        array('webp'));

foreach($fileScanner as $file)
{
    unlink(UPLOAD_BASE_PATH.$file);
}

Note: Code is not tested but hope this should work

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)