-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
44 lines (40 loc) · 885 Bytes
/
main.go
File metadata and controls
44 lines (40 loc) · 885 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package main
import (
"os"
"os/exec"
"path/filepath"
"log"
"strings"
"fmt"
)
func main(){
currentDirectory, err := os.Getwd()
currDir := getCurrDirName(currentDirectory)
if err != nil {
log.Fatal(err)
}
iterate(currentDirectory, currDir)
}
func getCurrDirName(path string) string{
dirName := strings.Split(path, "/")
return dirName[len(dirName)-1]
}
func iterate(path string, currDir string){
filepath.Walk(path, func(path string, info os.FileInfo, err error) error {
if err != nil{
log.Fatalf(err.Error())
}
if(info.Name() != currDir){
if(info.IsDir()){
//Dentro de las carpetas de cada dia
cmd := exec.Command("/bin/sh", "-c", "(cd " + path + ";" + "../import-cv.sh lemus-maps.disca.upv.es)")
out, err := cmd.CombinedOutput()
if err != nil {
log.Fatalf(err.Error())
}
fmt.Printf(string(out))
}
}
return nil
})
}