By default WhatsApp download the images and videos received in messages automatically to make for a better experience. While you can choose to disable that feature, I don't like to have to tap on every image before I can see it.

When enabled, WhatsApp also never deletes old images, so if you receive a lot of media messages you will end up with hundreds of files taking up a lot of space on your device.

This Tasker profile automatically cleans up old media files. It runs every day at 3 AM and loops through the media files deleting anything older than 7 days.

The profile uses Tasker JavaScriptlet

var prefix = 'WhatsApp/Media/WhatsApp ';
var dirs = ['Audio', 'Images', 'Stickers', 'Video'];

for (var dir of dirs) {
    var files = listFiles(prefix + dir, false).split('\n');
    for (var file of files) {
        if (!file.includes('-')) {
        var date = file.split('/').slice(-1)[0].split('-')[1];
        date = date[0] + date[1] + date[2] + date[3] + '-' + date[4] + date[5] + '-' + date[6] + date[7];
        date = new Date(date);
        var now = new Date().getTime();
        if (now - date.getTime() > 7 * 24 * 60 * 60 * 1000) {

You can also import the profile from Taskernet Link