Guest User

Untitled

a guest
Jan 21st, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. // Globcount
  2. // Counts number of files in a directory
  3. // Copyright Ghostworks Systems - 2011
  4.  
  5. package main
  6.  
  7. import (
  8. "os"
  9. "path/filepath"
  10. "fmt"
  11. )
  12.  
  13. func main() {
  14. // Hardcode for now
  15. globstr := "/home/luke/Dropbox/**/*"
  16. pirate, err := filepath.Glob(globstr)
  17. // if err is set, then exit
  18. if err != nil {
  19. fmt.Printf("An error has occoured with glob\n")
  20. os.Exit(1)
  21. }
  22.  
  23. // For each item in pirate, add to i
  24. x := 0
  25.  
  26. // Err I hope this works
  27. for i := 0; i < len(pirate); i++ {
  28. x += 1;
  29. }
  30.  
  31. fmt.Printf("%d\n", x);
  32. }
Add Comment
Please, Sign In to add comment