Commons IO
  1. Commons IO
  2. IO-263

FileSystemUtils.freeSpaceKb throws exception for Windows volumes with no visible files.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.1
    • Fix Version/s: 2.1
    • Component/s: Utilities
    • Labels:
      None
    • Environment:

      Windows XP SP3

      Description

      Doing a FileSystemUtils.freeSpaceKb("D:/") where the drive (in this example d:) is an empty drive (A drive with no non-hidden files on it yet) results in an exception being thrown.

      "Command line returned OS error code '1' for command [cmd.exe, /C, dir /-c "D:\"]

      Perhaps it could do a "dir /a /-c" to work in more cases? (Since hidden file "System Volume Information" will usually be available)

        Activity

        Hide
        Gary Gregory added a comment -

        Closing, we released version 2.1.

        Show
        Gary Gregory added a comment - Closing, we released version 2.1.
        Hide
        Sebb added a comment - - edited

        Note: this method becomes redundant on Java 1.6+, as the java.io.File class finally has getFreeSpace()/getUsableSpace() etc.

        Show
        Sebb added a comment - - edited Note: this method becomes redundant on Java 1.6+, as the java.io.File class finally has getFreeSpace()/getUsableSpace() etc.
        Hide
        Gil Adam added a comment -

        Actually, I am doing

        FileSystemUtils.freeSpaceKb("d:/", 15000);

        Show
        Gil Adam added a comment - Actually, I am doing FileSystemUtils.freeSpaceKb("d:/", 15000);

          People

          • Assignee:
            Unassigned
            Reporter:
            Gil Adam
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development