-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
49 lines (41 loc) · 806 Bytes
/
main.go
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
45
46
47
48
49
package main
import (
"fmt"
"os"
"os/exec"
"path/filepath"
)
func RemoveContents(dir string) error{
d, err := os.Open(dir)
if err != nil{
return err
}
defer d.Close()
names, err := d.Readdirnames(-1)
if err != nil{
return err
}
for _, name := range names{
err = os.RemoveAll(filepath.Join(dir, name))
if err != nil{
return err
}
}
return nil
}
func StartProcess(Filename string) {
// Filename = "cmd /C start \"" + Filename + "\""
cmd := exec.Command(Filename)
err := cmd.Start()
if err!=nil{
fmt.Println(err)
}
}
func main(){
err := RemoveContents("C:\\Program Files (x86)\\Steam\\appcache\\httpcache")
if err != nil{
fmt.Println(err)
os.Exit(1)
}
StartProcess("C:\\Program Files (x86)\\Steam\\steam.exe")
}