Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-403

allow easier recursive file processing with File.eachFileRecurse { ... }

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.0-beta-5
    • None
    • None

    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() }

      Attachments

        Activity

          People

            guillaume Guillaume Sauthier
            jstrachan James Strachan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: