Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Globcount
- // Counts number of files in a directory
- // Copyright Ghostworks Systems - 2011
- package main
- import (
- "os"
- "path/filepath"
- "fmt"
- )
- func main() {
- // Hardcode for now
- globstr := "/home/luke/Dropbox/**/*"
- pirate, err := filepath.Glob(globstr)
- // if err is set, then exit
- if err != nil {
- fmt.Printf("An error has occoured with glob\n")
- os.Exit(1)
- }
- // For each item in pirate, add to i
- x := 0
- // Err I hope this works
- for i := 0; i < len(pirate); i++ {
- x += 1;
- }
- fmt.Printf("%d\n", x);
- }
Add Comment
Please, Sign In to add comment