This utility script takes a site config file and finds its uploads directory. Every storage location is checked against the site's database and if it is no longer in use, it is moved to uploads/arch for archiving/deletion.
The reason for creating the script was because our WG upload process failed lots of times on uploading images to galleries - and this left a lot of old files in uploads.
Running this script took our site down from 19G to 2.5G.
There is a version suited to the wre - place fileCleanup.pl in /data/WebGUI/sbin
There is also a version for Debian's webgui installation, place wg-fileCleanup in /usr/bin and chmod +x it.