Walk a directory/Recursively: Difference between revisions
Content added Content deleted
(→{{header|C}}: putc takes 2 arguments (RTFM). maybe you wanted putchar?) |
(added go) |
||
Line 382: | Line 382: | ||
s" ." ls-r</lang> |
s" ." ls-r</lang> |
||
=={{header|Go}}== |
|||
package main |
|||
import ( |
|||
"fmt" |
|||
"path" |
|||
"os" |
|||
) |
|||
type MyVisitor struct {} // some dummy type |
|||
func (self MyVisitor) VisitDir(_ string, _ *os.FileInfo) bool { |
|||
return true |
|||
} |
|||
func (self MyVisitor) VisitFile(filepath string, _ *os.FileInfo) { |
|||
if path.Ext(filepath) == ".mp3" { |
|||
fmt.Println(filepath) |
|||
} |
|||
} |
|||
func main() { |
|||
path.Walk("/", MyVisitor{}, nil) |
|||
} |
|||
=={{header|Groovy}}== |
=={{header|Groovy}}== |