Size of free space root disk

Hi
I try to obtain the free space disk of c:\ (under windows NT). I use the class File but i obtain a size of 0 for the drive C:\
I use :
private static boolean estSuperieurAuSeuil(String disque, long seuil) {
File lecteur = new File("c:\");
//File lecteur = new File(disque);
long volumeOccupe = lecteur.length();
     if (volumeOccupe >seuil) {
     return true;
     } else {
     return false;
but volumeOccupe is always equals to 0
Anyone can help me !
Thanks
}

Why don't you implement your own code to calculate the full size of the disk?
Windows system itself does a recursive count.
(Which makes the request for a bug not founded since everytime you ask for the size, you would have to wait until the count is done.)
you could do this :
public long diskSize(File root) {
if(root != null && root.isDirectory()) {
File[] fs = root.listFiles();
long ret = 0;
for(int i = 0; i < fs.length; i++) {
ret += diskSize(fs);
} else {
return root.getSize();
and then call it with diskSize("c:\");
Hopes this helps
Anthony

Similar Messages

  • How can validate the ASM size and free space correctly?

    Dears ,,
    I faced problem in ASM size as it appeared in alert file as below
    ORA-19504: failed to create file "+DG_DATA"
    ORA-17502: ksfdcre:4 Failed to create file +DG_DATA
    ORA-15041: diskgroup space exhausted
    So we resize ASM space and large it. But we faced the same problem also although there is free space in ASM.
    It seems that the shown free space is not real.
    How can validate the ASM size and free space correctly?
    Thanks & Regards,,

    *Oracle DBA* wrote:
    Dears ,,
    I faced problem in ASM size as it appeared in alert file as below
    ORA-19504: failed to create file "+DG_DATA"
    ORA-17502: ksfdcre:4 Failed to create file +DG_DATA
    ORA-15041: diskgroup space exhausted
    So we resize ASM space and large it. But we faced the same problem also although there is free space in ASM.
    It seems that the shown free space is not real.
    How can validate the ASM size and free space correctly?
    Thanks & Regards,,
    I was having this problem. Im my case i couldn add datafiles to a tablespace despite the fact that i was having a lot of space in the asm. Try rebalancing. It might help. In my case rebalancing also didn work because it seems that there need to be a threshold space in all the disks for the rebalancing to happen which was not in my case, so i had to shrink some unused space in the tablespace and then after gaining the required space I rebalanced the disk and then the disks got rebalanced, also i was able to use the free space that was showing .

  • Error: There is insufficient free space on disk volume

    Hello All,
    I am trying to add Appset and getting this error:
    Error message:There is insufficient free space on disk volume 'E:\' to create the database. The database requires XXXXX additional free bytes, while only yyyyy bytes are available.
    My question is :
    Why I get this message although I didn't check the data or any other option when trying to copy my production AppSet?
    XXXX required is the size of my production AppSet DB.
    Can anyone please help?
    Best regards,
    Mahmoud

    Hi Santosh,
    Thanks for your answer.
    I am sorry I don't understand well what did you mean.
    What I wanted to say is that DataBase creation failed so AppSet copy has failed and this is due to lack of disk space as mentioned in the error message.
    If this would be clearer my question would be :
    - What is the minimum free disk space needed to create an "empty" AppSet? Empty means no options checked in the copy Appset wizard.
    FYI: I use BPC 7.0 SP8 SQLServer 2008
    Thank you for your help.
    Best Regards
    Mahmoud

  • Can't partition free space using Disk Utility

    So something went wrong when I tried to bootcamp.
    Now the situation is following:
    1) I can't install Windows using USB stick, it says that the free space is in GPT;
    2) I can't partition the free space with Disk Utility, tryied it also with recovery mode, the apply button is clickable and active, but it does nothing, it just stays like so and when I exit from Disk Utility it asks if I want to quit without applying but it doesn't work.
    So basically I have wasted 20GB of space and can't do anything with it.
    I don't want to format the hole disk, are there any other workarounds without need to reinstall OSX?
    I have MacBook Pro 13" Retina (late 2013), 128GB SSD, 8GB ram.

    markov-mac:~ markov$ diskutil list
    /dev/disk0
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:      GUID_partition_scheme                        *121.3 GB   disk0
       1:                        EFI EFI                     209.7 MB   disk0s1
       2:          Apple_CoreStorage                         100.3 GB   disk0s2
       3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
    /dev/disk1
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:                  Apple_HFS Macintosh HD           *100.0 GB   disk1
    markov-mac:~ markov$ diskutil cs list
    CoreStorage logical volume groups (1 found)
    |
    +-- Logical Volume Group 0F0D9268-58FC-4832-8FCB-4A11FB5675F6
        =========================================================
        Name:         Macintosh HD
        Status:       Online
        Size:         100335546368 B (100.3 GB)
        Free Space:   15724544 B (15.7 MB)
        |
        +-< Physical Volume 9B8968BE-CE97-4A66-B5B3-31B4EB87E21F
        |   ----------------------------------------------------
        |   Index:    0
        |   Disk:     disk0s2
        |   Status:   Online
        |   Size:     100335546368 B (100.3 GB)
        |
        +-> Logical Volume Family B29C277A-660B-41C4-8F5C-A1C5FB01B60F
            Encryption Status:       Unlocked
            Encryption Type:         None
            Conversion Status:       NoConversion
            Conversion Direction:    -none-
            Has Encrypted Extents:   No
            Fully Secure:            No
            Passphrase Required:     No
            |
            +-> Logical Volume 6736784D-A946-4EBF-BBA2-BC7DDC6C4EDE
                Disk:                  disk1
                Status:                Online
                Size (Total):          99999997952 B (100.0 GB)
                Conversion Progress:   -none-
                Revertible:            No
                LV Name:               Macintosh HD
                Volume Name:           Macintosh HD
                Content Hint:          Apple_HFS
    markov-mac:~ markov$ mount
    /dev/disk1 on / (hfs, local, journaled)
    devfs on /dev (devfs, local, nobrowse)
    map -hosts on /net (autofs, nosuid, automounted, nobrowse)
    map auto_home on /home (autofs, automounted, nobrowse)
    map -fstab on /Network/Servers (autofs, automounted, nobrowse)

  • Start up and shut down is slow after erasing free space using disk utility?

    I went to Disk Utility, clicked Erase, and then "Erase Free Space." When I saw that it was going to take 1 hour and 30 minutes, I tried closing disk utility. It wouldn't let me exit, so instead I pressed "Skip." But when you hover over the "Skip" button it says, "Erase all data and reformat the disk."
    I'm wondering if the fact that I pressed the skip button has anything to do with my computer shutting down/starting up A LOT slower now. If so, what can I do to fix it?
    Thanks!

    Just wanted to give an update. I called Apple and apparently, you shouldn't empty the free space using disk utility while you're logged in. I had to insert the Installations CD and press the "C" button while my computer restarted, and used Disk Utility from there. My start up and shut down speed still isn't exactly the way it was before, but this definitely made a difference.
    Thank you to those who replied to my question!

  • Less and less free space in disk everyday!?

    A few days ago I noticed that my free space in disk was going down with no apparent reason... yesterday I woke up and discovered that my free space in disk was... 0kb! doing nothing different, nor downloading stuff or so...
    I 've been searching all day long for a reason and discovered some files in /private/var/log/DiagnosticMessages/ that apparently went nuts (2, 5 & 6 Gib logfiles?):
    !http://img23.imageshack.us/img23/5405/capturadepantalla200909.png!
    Does anyone know something about?

    If you haven't already - try a shutting it down rather than putting it to sleep.
    I've been experiencing exactly the same thing. I was excited when Leopard gave me an additional 11gb of free space - but then it started shrinking.
    For the last 5 days, EVERYTIME I turn my computer on it says "Zero MB available". Each day I've had to clear between 1-2gb a day to allow myself to do the most basic of tasks.
    I reckon it's a problem with the swap files. I just "Shut Down" my computer and on a restart gained 12gb back.
    I'd be interested to know if this works for you.
    Steve

  • Erased free space in Disk Utility, and after it finished it kept a DMG there.

    I erased free space in Disk Utility, and after it finished it kept a DMG there called "DeveloperDiskImage.dmg", why is it left behind? can it be deleted? how? if erasing free space is supposed to help get memory and remove all the files truly, it shouldnt be creating anything, it created a DMG at the start, but it went away, after a hour and a half it made the DeveloperDiskImage, i went to eat dinner and when i came back it was done but that was left.

    Delete it. Erasing the free space isn't supposed to free up any space; it's there in case someone deleted a file insecurely when they meant to securely delete it.
    (65417)

  • Clicked erase free space in disk utility, now I have no SPACE!

    I ran erase free space in disk utility in hopes of freeing up more room on my hard drive, and had 34 GB free, but now it says zero kb available. I have never done this before. It still has twelve hours to go, and I was wondering if this was normal.
    MacBook   Mac OS X (10.4.7)   White 2 Ghz.
    MacBook   Mac OS X (10.4.7)   White 2 Ghz.

    Doing so does not free up any hard drive space.
    Copied from this link.
    http://docs.info.apple.com/article.html?path=DiskUtility/10.5/en/duh1010.html
    You might see a message saying that you are running out of disk space, but you can ignore that warning. When this operation is complete, you will have the same amount of free space as you did when it started.
    For suggestions to free up hard drive space, check this link.
    http://www.thexlab.com/faqs/freeingspace.html

  • Time Capsule full after a "Erase Free Space" using Disk Utility

    Hello,
    I am facing some issues related to my Time Capsule.
    Reviewing my past, I had a lot of backups on this, using Time Machine and it always worked pretty well. But after deleting some backups manually to reclaim disk space, this was not exactly freeing it.
    Searching in the forum here, I saw that I could mount the backup sparsebundle image and map it into the Disk Utility. This always worked greatly too both for disk checking and reclaiming the space back.
    The problem starts on the last Friday when I performed the operation again, but it started using the whole free space that I had and did not give it back.
    Studying the case I found that it creates a temporary folder to store the file it creates to write the byte 0 on the disk. This file actually resides in the sparsebundle image and therefore I can see the file with 200GB, for example, in the Finder, this is a split in bands (8MB) just like the backup is. After the disk gets full, the Disk Utility should delete the file properly and give me back the space safely.
    Right now my Time Capsule has 0 byte free and I can't do anything on it beyond redo the the Erase Free Space operation. When I do it, it starts writing the temporary file again and the problem repeats itself.
    I know that if I backup the data and really erase the disk, I'll get it back, but this is not an option for me because I want a smart solution for this.
    The only thing that changed between when it worked and now is the 10.5.6 update that I made and I'd like that it's not the root of the issue.
    Is there any suggestion or general stuff I could do to fix it?
    Did anybody already face the same issue?
    If anyone needs more details to help me out of this, just let me know.
    Thanks and regards,
    Eduardo

    Just another thing to add, I'd like a good solution for this as the redo operation from Disk Utility takes around 2 days and then it just "dies".

  • Erasing free space using disk utility

    Disk utility does not always work when trying to erase free space...  I have 50 gigs of free space that I can not retrieve...   I do not want to have erase my entire SSD like I did a month ago to clean up deleted files...

    In Dec I did a complete re-install of Lion, because I was running out of SSD storage...
    The other day, the Mac Air was acting strange, so I checked the SSD drive and found there was only 25 free gigs left...  60 gigs had disappeared in 5 weeks... 
    Here is where the 60 gigs went...
    1.  Added 9 gigs for new pictures
    2.  IPOD/iPhone Photo Cache added 13 gigs (It was emptied during the Lion re-install)
    3.  Time Machine, kept making hourly back-ups on the SSD, added 38 gigs (Turn off Time Machine & 38 gigs returned as free space)
    Thanks to those who suggested I use Omni Desk Sweeper, which shows you what your files sizes are by each file & to turn off the Time Machine...

  • Greyed Out "Free Space" in Disk Utility

    Hi
    I have a problem with my main Logical Volume Group / Partition. So My main Logical Volume Group (Macintosh HD) was separated into 2 partitions. I decided to delete the second one, and once the process started in Disk Utility, it crashed. Now if I look at the Logical Volume Group, it is separated in two, first one being Macintosh HD, and the second one is greyed out and is "Free Space".
    Now If I look at the info of my Logical Volume Groupe, it says "Capacity 853,07 GB / Available 115 KB" when in actuality I have a 1TB fusion Drive, If I look at the Macintosh HD PARTITION, it says "Capacity 844,56GB / Available 252.99GB" which evidently doesn't add up. The "Free Space" is supposedly 267,78GB...
    I tried "filling" that free space with a new partition, but when I apply the changes to the partition layout, nothing happens, and it reverts back to being greyed out and empty. (I tried both in Disk Utility, and in Disk Utility while in Recovery Mode, and I've also Repaired the volume and the partition)
    How can I either force-create a partition with that free space, so that I can use all of my actual HDD space, or completely erase that "Free Space" and have my Macintosh HD partition fill the whole Logical Volume Group. (I tried erasing the free space of the Macintosh HD volume, but it didn't change anything.
    Hopefully, there is a way to do it without having to back up my whole Macintosh HD partition, and reformatting my whole computer...
    Thanks

    If you wish to delete data, the best option would be to encrypt everything on the drive (locking everything with a password)  and then erasing the drive.   This would atleast scramble the left over data.   The problem is that SSDs have a wear controlling firmware that distribute the load accordingly, so the entire drive wears evenly.   Secure erase wouldnt work since secure erase works by first erasing the refrences to the data, and then writing 0s over the left over data.   Since the firmware distributes the load differently each time, there is no guarantee that the data would be covered in 0s.  

  • Finder reports different free space on disk compared to DiskUtil

    After upgrading to Lion I am facing a very strange problem:
    Finder reports much more free space on my Macintosh HD compared to Disk Utility. I also take a look on what Daisy Disk reports and
    daisy Disk reports exactly the same numbers  like Disk Utility. Booted into Lion recovery partitions and preformed disk verify and repair.
    Everything seems to be fine except that finder reports significantly more free space (350 GB) compared to Disk Utility (364 GB).
    Any advise ?

    Trash is empty. Checked this also via Terminal. And one more comment: I do not have a Bootcamp partition. I never had one and never created one.

  • System Won't Reboot Proper After Running "Erase Free Space" in Disk Utility

    Thought I'd run it to see what happened.
    On an 80gb HD with 35gb free, I was told I was running out of free space partway through the erase, program then quit. Kept system going for about two days without problems, then shut it down for a day. When I rebooted a few hours ago, it seemed to take forever to do so, followed by a dim perpetual blue screen which I couldn't brighten via the keyboard. Waited 20 minutes for screen to resolve into my desktop; alas, no such luck. Rebooted a few times, no change.
    17 pB @ 1.33ghz & 1.5gb RAM   Mac OS X (10.4.7)  

    One of the first things I tried: no effect.
    Booted on the MacOS X CD and ran disk utility and it found errors, fixed them, rebooted from the hard drive and now I get a perpetual grey screen with the li'l rotater. Zapping doesn't do anything this time either.

  • "Erase Free Space" in disk utility, writes a large file?

    While poking around in disk utility I came upon the 'Erase Free Space" function so I decided to try it out and see how it worked. I chose the medium security setting and let it run. After a while I stopped it because it was going quite slowly. Afterwards I noticed that about 25gb of previously free space was gone from my HD. Did it write a backup file?
    I tried looking for a file but "find" in finder coldn't seem to locate any files written during that time period.
    any direction to recoup the space is greatly appreciated.

    OK, thanks guys.
    Sometimes the simplest things...
    Now if I were at the office working on something on a windoze machine a restart would be the first thing I would try, you have to restart twice a day even if the machine is working properly!
    I however, rarely shut down my Mac. Unless there is a thunderstorm or I am going away, or I've performed an update, the machine stays on/sleeps.
    Apparently as an "erase free space " is being performed the space is being used as zeroes are written. When I allowed it to complete the space returned. However; the space that was consumed during the aborted try was still not availible.
    Only after a restart did the space become shown as being free.
    This has been great since I now know of 2 more helper apps. Tinker Tool allows me to see hidden files and change other prefs not availible natively. OmniDiskSweep quickly check file on the HD.
    Thanks for your help, and if there were votes still, I'd use them all!
    -T

  • Erase Free Space then Disk Full

    help. I ran erase free space in DU, worked fine but then created some temp file/s which then filled my HD up. Where are these file/s so I can delete it. Before I had over 400G free, now nothing.
    Is this normal when you run secure delete..?
    Slee

    Hi Glynn... So I gather. However, I didn't know at the time and may have screwed up. It ran fine for an hour, then said writing temporary files. After a few min's I got the error message start-up disk full, which it was. Not knowing what was happening, I hit skip. It them seem to hang, so I forced a quit.
    Before I has 450G+ free on my disk, now less than a 100 meg. Oh dear. It seems by forcing a quit of DU these temp files have still to be deleted. Where are they..?
    Help
    Steve

Maybe you are looking for

  • How do I fade out audio in Premiere Elements 13?

    HOW DO I FADE OUT AUDIO IN PREMIERE ELEMENTS 13?

  • Analytic function to retrieve a value one year ago

    Hello, I'm trying to find an analytic function to get a value on another row by looking on a date with Oracle 11gR2. I have a table with a date_id (truncated date), a flag and a measure. For each date, I have at least one row (sometimes 2), so it is

  • Nokia N95 WEP password

    Hi My Nokia N95 sees my airport express and asks for the WEP password which I've typed in. I've checked it ten times and the N95 is still saying it's the wrong password. Any ideas. PowerBook G4 1.67   Mac OS X (10.4.10)  

  • How to recognize file type (bytearray type)

    Hi, what ist the simplest way to detect file type or the type of byte[ ]? I mean, for example, how to detect if a "xyz.pdf" is a "really" PDF-File and not some Jpg with ".pfd"-extension. Thanx in advance vedran

  • Priority launch of business rules

    Hi! I have a BR question and can't seem to get it resolve. I created three BRs then I attached my BRs in Planning form with run on save, but when I save the form the BR I don't know what is sequence launch of business rules. Who is the first and who