diff --git a/core/src/main/java/hudson/FilePath.java b/core/src/main/java/hudson/FilePath.java index df548f5583364df32be1242190c16b8cef9e5bf7..ad5b62c1d1e06930fbbd1ff45c093390600e3f18 100644 --- a/core/src/main/java/hudson/FilePath.java +++ b/core/src/main/java/hudson/FilePath.java @@ -1406,6 +1406,45 @@ public final class FilePath implements Serializable { }); } + /** + * Returns the number of unallocated bytes in the partition of that file. + * + */ + public long getFreeDiskSpace() throws IOException, InterruptedException { + return act(new FileCallable() { + private static final long serialVersionUID = 1L; + public Long invoke(File f, VirtualChannel channel) throws IOException { + return f.getFreeSpace(); + } + }); + } + + /** + * Returns the total number of bytes in the partition of that file. + * + */ + public long getTotalDiskSpace() throws IOException, InterruptedException { + return act(new FileCallable() { + private static final long serialVersionUID = 1L; + public Long invoke(File f, VirtualChannel channel) throws IOException { + return f.getTotalSpace(); + } + }); + } + + /** + * Returns the number of usable bytes in the partition of that file. + * + */ + public long getUsableDiskSpace() throws IOException, InterruptedException { + return act(new FileCallable() { + private static final long serialVersionUID = 1L; + public Long invoke(File f, VirtualChannel channel) throws IOException { + return f.getUsableSpace(); + } + }); + } + /** * Sets the file permission. *