summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard Jones <rjones@trick.home.annexia.org>2009-05-19 12:05:33 +0100
committerRichard Jones <rjones@trick.home.annexia.org>2009-05-19 12:05:33 +0100
commitd1df2f342489bbbba086cae2bb95971c8e404cad (patch)
treec1608bc9f0028f79856a51ee6038ef92ff558d0f /src
parent8b4819058243957c8fbbc92ef4fbbc0b46655380 (diff)
downloadlibguestfs-d1df2f342489bbbba086cae2bb95971c8e404cad.tar.gz
libguestfs-d1df2f342489bbbba086cae2bb95971c8e404cad.tar.xz
libguestfs-d1df2f342489bbbba086cae2bb95971c8e404cad.zip
Added 'find' command.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/generator.ml39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/generator.ml b/src/generator.ml
index 8ebfafbb..01a23095 100755
--- a/src/generator.ml
+++ b/src/generator.ml
@@ -2122,6 +2122,45 @@ is lost.");
This resizes an ext2 or ext3 filesystem to match the size of
the underlying device.");
+ ("find", (RStringList "names", [String "directory"]), 107, [],
+ [InitBasicFS, Always, TestOutputList (
+ [["find"; "/"]], ["lost+found"]);
+ InitBasicFS, Always, TestOutputList (
+ [["touch"; "/a"];
+ ["mkdir"; "/b"];
+ ["touch"; "/b/c"];
+ ["find"; "/"]], ["a"; "b"; "b/c"; "lost+found"]);
+ InitBasicFS, Always, TestOutputList (
+ [["mkdir_p"; "/a/b/c"];
+ ["touch"; "/a/b/c/d"];
+ ["find"; "/a/b/"]], ["c"; "c/d"])],
+ "find all files and directories",
+ "\
+This command lists out all files and directories, recursively,
+starting at C<directory>. It is essentially equivalent to
+running the shell command C<find directory -print> but some
+post-processing happens on the output, described below.
+
+This returns a list of strings I<without any prefix>. Thus
+if the directory structure was:
+
+ /tmp/a
+ /tmp/b
+ /tmp/c/d
+
+then the returned list from C<guestfs_find> C</tmp> would be
+4 elements:
+
+ a
+ b
+ c
+ c/d
+
+If C<directory> is not a directory, then this command returns
+an error.
+
+The returned list is sorted.");
+
]
let all_functions = non_daemon_functions @ daemon_functions