Last active
December 30, 2017 04:40
-
-
Save jiro4989/be89b2ac3da303eb0b9624fbcc5dc60a to your computer and use it in GitHub Desktop.
空のダミーファイルを生成するスクリプト(powershell, python, go)
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" | |
| "os" | |
| ) | |
| func init() { | |
| log.SetFlags(log.Ldate | log.Ltime | log.Lshortfile) | |
| } | |
| func main() { | |
| for i := 0; i < 120; i++ { | |
| filepath := fmt.Sprintf("go/dummy%03d.zip", i) | |
| var b []byte | |
| err := ioutil.WriteFile(filepath, b, os.ModePerm) | |
| if err != nil { | |
| log.Fatal(err) | |
| } | |
| fmt.Println("<" + filepath + "> is created.") | |
| } | |
| } |
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
| 0..120 | % { | |
| $num = ([string]$_).PadLeft(3, "0") | |
| echo "" > "ps1\dummy$num.zip" | |
| } | |
| ls ps1 |
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
| #!/usr/bin/env python3 | |
| # -*- coding: utf-8 -*- | |
| def main(): | |
| for i in range(0, 120): | |
| with open("py/dummy{0:03d}.zip".format(i), "w"): | |
| pass | |
| if __name__ == '__main__': | |
| main() |
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
| 120.times do |i| | |
| fn = "rb/dummy%03d.zip" % i | |
| File.open(fn, "w") do |outfile| | |
| outfile.puts "" | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment