Skip to content

unRAID⚓︎


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
#name=delete_empty_cache_directories
#description=dremy - Delete empty directories from the cache for shares which have shareUseCache set to 'yes'
#arrayStarted=true

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