• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
Bartenders:
  • Himai Minh
  • Carey Brown
  • Frits Walraven

Directory lengths

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi - does anyone know if there's a way to very quickly get the size of a directory? I am writing a Windows's-like filechooser popup that lists the sizes of files and directories. For directories, I am using a recursive function that adds up the sizes of the files and subdirectories. But sometimes this doesn't work fast enough, and my program starts to hang. I'm hoping there's some obscure Java extension call that I don't know about. Or is there some Windows shell function I can call directly though to? Thanks.
 
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is no quick way to get the size (disk usage) of whole directory with all subdirectories. It is needed to read all subdirectories (recursively) from disk (at least those which are not in cache) which is slow for bigger directory tree.

Using an OS function may seed id up, but the disk accesses are still required.
[ December 20, 2005: Message edited by: Vlado Zajac ]
 
catch it before it slithers away! Oh wait, it's a tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic