Skip to content


User Scripts⚓︎

Delete Empty Cache Directories⚓︎

I found in unRAID 6.8 the cache had many directories which were empty. This was due to the mover not cleaning up once it moved files to the data disks. Minor annoyance to me, but easy to clean.

#!/bin/env bash
#description=dremy - Delete empty directories from the cache for shares which have shareUseCache set to 'yes'

echo "Searching for (and deleting) empty directories in the cache"
find $(grep -l 'shareUseCache="yes"' /boot/config/shares/* | awk -F'/' '{print $5}' | awk -F'.' '{print "/mnt/cache/"$1}') -type d -empty -delete