Created
March 17, 2018 14:42
-
-
Save wnoguchi/b594f239f173f57c43a083936b905ae7 to your computer and use it in GitHub Desktop.
Open junkfile golang windows version.
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" | |
"time" | |
"bufio" | |
"io/ioutil" | |
"os" | |
"os/exec" | |
"strings" | |
) | |
func main() { | |
//fmt.Println("hello, world") | |
nowTime := time.Now() | |
const yyyymmdd = "2006/01/02" | |
const ymdhis = "20060102-150405" | |
str1 := nowTime.Format(yyyymmdd) | |
str2 := nowTime.Format(ymdhis) | |
fmt.Printf("now -> %s\n", str1) | |
fmt.Printf("now -> %s\n", str2) | |
reader := bufio.NewReader(os.Stdin) | |
fmt.Print(str2, "-") | |
text, _ := reader.ReadString('\n') | |
text = strings.TrimSuffix(text, "\r\n") | |
//text = text[:len(text)-2] | |
fmt.Println(text) | |
folderPath := "D:/Users/wnoguchi/Dropbox/Documents/junk/" + str1 | |
os.MkdirAll(folderPath, os.ModePerm) | |
filePath := folderPath + "/" + str2 + "-" + text | |
fmt.Println(filePath) | |
d1 := []byte("") | |
//err := ioutil.WriteFile(filePath, d1, os.ModePerm) | |
ioutil.WriteFile(filePath, d1, os.ModePerm) | |
//if err := os.MkdirAll("hoge/fuga", 0777); err != nil { | |
// fmt.Println(err) | |
//} | |
//C:\Program Files\EmEditor\EmEditor.exe | |
//cmd:= exec.Command("cmd","/C","start","C:/Program Files/EmEditor/EmEditor.exe", filePath) | |
cmd:= exec.Command("C:/Program Files/EmEditor/EmEditor.exe", filePath) | |
//err:=cmd.Start() | |
cmd.Start() | |
//panic(err) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment