neonsignal |
10-27-2010 04:54 AM |
Quote:
Originally Posted by Manjunath1847
(Post 4140424)
Since process of adding new files and purging old files happens very frequently I am afraid if the calling stat() on each file would cause performance issue.
|
It will depend on how often you do it. If you are running it all the time, you will find that the directory entries will get cached and it will run relatively fast after the first scan is done. But yes, it will be wasting some resources.
If your application is a continuously running process (ie, a daemon), then it could make use of the inotify interface. In other words, after an initial scan, it would incrementally keep track of the changes (such as total size) as files within the hierarchy change and the changes are reported back.
|