Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.4.11
-
None
-
Windows Linux
Description
The documentation for those two methods states: "Sub-directories are recursively searched in a depth-first fashion." But the result is NOT depth-first, as the following example shows:
Given a directory tree of
/tmp |-/foo | |-/bar | |-/foo | |-/bar | |-/baz |-/baz
the following simple code
#!/usr/bin/groovy File rootDir = new File(new URI('file:/tmp/foo')) rootDir.eachDirRecurse { println(it) }
gives this result
/tmp/foo/bar /tmp/foo/bar/baz /tmp/foo/bar/foo /tmp/foo/bar/bar /tmp/foo/baz
while
% find /tmp/foo -depth -type d
correctly gives
/tmp/foo/bar/baz /tmp/foo/bar/foo /tmp/foo/bar/bar /tmp/foo/bar /tmp/foo/baz /tmp/foo
Attachments
Issue Links
- links to