Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 1.0-beta-5
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
There's an interesting discussion here...
http://wiki.codehaus.org/groovy/FileSupport
one thought was recursive deletion...
def recursiveDelete(File file) {
outer = this
if( file.isDirectory() ) {
file.eachFile
}
file.delete()
}
I wondered if we should have a recursive file method where you could do
new File("/home/foo").eachFileRecurse
{ println it.name }which would iterate through all files recursively like the above - calling children first before parents.
Then a recursive delete would be
file.eachFileRecurse
{ it.delete() }Activity
james strachan
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Fix Version/s | 1.0-rc1 [ 10510 ] | |
| Description |
There's an interesting discussion here... http://wiki.codehaus.org/groovy/FileSupport one thought was recursive deletion... def recursiveDelete(File file) { outer = this if( file.isDirectory() ) { file.eachFile { outer.recursiveDelete(it) } } file.delete() } I wondered if we should have a recursive file method where you could do new File("/home/foo").eachFileRecurse { println it.name } which would iterate through all files recursively like the above - calling children first before parents. Then a recursive delete would be file.eachFileRecurse { it.delete() } |
There's an interesting discussion here... http://wiki.codehaus.org/groovy/FileSupport one thought was recursive deletion... def recursiveDelete(File file) { outer = this if( file.isDirectory() ) { file.eachFile { outer.recursiveDelete(it) } } file.delete() } I wondered if we should have a recursive file method where you could do new File("/home/foo").eachFileRecurse { println it.name } which would iterate through all files recursively like the above - calling children first before parents. Then a recursive delete would be file.eachFileRecurse { it.delete() } |
Guillaume Laforge
made changes -
| Resolution | Fixed [ 1 ] | |
| Status | Open [ 1 ] | Resolved [ 5 ] |
Paul King
made changes -
| Status | Resolved [ 5 ] | Closed [ 6 ] |