PDA

View Full Version : get the correct size of directories


Leo.1906
05-16-2012, 05:45 PM
Hello :)
I'm new to ioftpd. Yesterday I decided to give it a try after I failed at installing drftpd on my windows system :D

.. so far it's working very well, but there is one little thing that I want to get changed. Ioftpd can give FlashFXP the size of the folders it's listening, so that I can know how big the files inside are without changing the dir.
But this isn't working quite proper. It's only showing the size of some folders (in the root dir) but even those are not correct. When I change to the subfolders I can see the correct size of each folder, but why can't the size of the subfolders be count together and shown in the root dir?

I attached a picture of what I mean, because a picture say's more than 1000 word's and I know that my english is horrible :P

Thanks for your help! :)

Leo.1906
05-22-2012, 02:23 PM
~ push ~
:)

Yil
05-26-2012, 12:06 PM
ioFTPD will only report the size of the files in immediate subdirectories (but not children of those subdirs) during a directory listing. Many other FTP servers don't report any size at all because they don't cache multiple directory contents. I think drFTPD is sort of unique because the Master doesn't keep any files itself so it was simpler to keep somewhat accurate usage totals for entire directory trees because it was just stuffing data in a huge memory database and didn't use the filesystem itself to cache info as is usually done. It also assumes that nothing else will touch the files on slaves (i.e. nobody adding/deleting via windows explorer), and that there is only 1 way to view the filesystem. ioFTPD allows multiple .vfs files so the total size for 1 person seeing the /archive directory might be radically different than another user's viewing the /archive dir who can see more of it.

This doesn't mean that ioFTPD couldn't report total tree sizes in the future when I switch over to the new directory caching code, but it won't be anytime really soon. The only way to cheat and do it quickly would be to assume the entire filesystem can be cached in memory or allow only 1 VFS view (and somehow account for hidden dirs throughout the filesystem) so it could be stored in a database...

The reason we just do 1 level deep is because going deeper has consequences. If you enter a directory with a subdir for every day that's 365 dirs it has to cache right now (assuming you haven't disabled subdir sizing entirely). However if you went 2 levels deep that could be 100K+ dirs assuming a few hundred per day! Ouch.

The only way around some of the issues is using a database and/or stashing subdir totals in parent dirs and ignoring hidden subdirs deeper in the tree. I've toyed with both, but neither are worth implementing until I switch to the new directory caching code.