summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2009-06-29 12:46:59 +0100
committerRichard W.M. Jones <rjones@redhat.com>2009-06-29 12:46:59 +0100
commit9a92446bcad09b492dee42dd5950bac67073fbea (patch)
treef03b179a243a379f462dba6d308360b084565b92 /src
parentb2ed0f4c55c2bd3d07341ba2207f0cb238eb4e18 (diff)
downloadlibguestfs-9a92446bcad09b492dee42dd5950bac67073fbea.tar.gz
libguestfs-9a92446bcad09b492dee42dd5950bac67073fbea.tar.xz
libguestfs-9a92446bcad09b492dee42dd5950bac67073fbea.zip
Added 'du' command.
This command estimates file usage for files and directories.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/generator.ml16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/generator.ml b/src/generator.ml
index 85e5c02f..5885ff3f 100755
--- a/src/generator.ml
+++ b/src/generator.ml
@@ -2583,6 +2583,22 @@ This command is mostly useful for interactive sessions. It
is I<not> intended that you try to parse the output string.
Use C<statvfs> from programs.");
+ ("du", (RInt64 "sizekb", [String "path"]), 127, [],
+ [InitBasicFS, Always, TestOutputInt (
+ [["mkdir"; "/p"];
+ ["du"; "/p"]], 1 (* ie. 1 block, so depends on ext3 blocksize *))],
+ "estimate file space usage",
+ "\
+This command runs the C<du -s> command to estimate file space
+usage for C<path>.
+
+C<path> can be a file or a directory. If C<path> is a directory
+then the estimate includes the contents of the directory and all
+subdirectories (recursively).
+
+The result is the estimated size in I<kilobytes>
+(ie. units of 1024 bytes).");
+
]
let all_functions = non_daemon_functions @ daemon_functions