Last active
March 22, 2021 07:01
-
-
Save iampato/d51f5e4f3ed458bbd9f3377bcf3ff51c to your computer and use it in GitHub Desktop.
Calling os.exec on some files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "io/ioutil" | |
| "log" | |
| "strings" | |
| "os/exec" | |
| ) | |
| const dir = "/home/pato/Desktop/icons/" | |
| func main() { | |
| files, err := ioutil.ReadDir(dir) | |
| if err != nil { | |
| log.Fatal(err) | |
| } | |
| for _, file := range files { | |
| if strings.Contains(file.Name(), ".go") { | |
| }else { | |
| cmd := exec.Command("/home/pato/Software/svgcleaner/svgcleaner",dir+file.Name(),dir+"new"+file.Name()) | |
| err := cmd.Run() | |
| fmt.Println("Finished:", err) | |
| fmt.Println(file.Name()) | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment