This plugin accelerates getting disk usage for given path by storing a cache file called ".du" in each directory under given path.
Reading the cache file is far faster than listing the directory content. To ensure that users can't view or modify the cache file, the plugin also installs filename filters for it.
The cache file contains the number of used bytes in that directory alone. It also lists the subdirectories of that directory. It is refreshed on demand if it is missing or if the last modified date of its parent directory differs from the last modified date of the cache file. The file system ensures that any change to a directory touches the last modified date of the directory. The exception being if a file is updated. However CrushFTP ensures that the last modified date of a directory is touched for any operation that affects the directory contents, therefore, this way of cacheing disk usage should be tight.
Remember to set 'Real File Quota' in order for the plugin to work!
Command line usage:
java -jar DiskUsage.jar [-f | -d] <path>
-f forces refresh and -d deletes all cache files.
API usage:
net.jalbum.diskusage.DiskUsage.getDiskUsage(File path, boolean forceCacheRefresh);
David Ekholm, Jalbum AB david_at_jalbum_dot_net
Add new attachment
List of attachments
Kind | Attachment Name | Size | Version | Date Modified | Author | Change note |
---|---|---|---|---|---|---|
zip |
DiskUsage.zip | 47.2 kB | 1 | 09-Oct-2016 18:14 | Ben Spink |