Skip to content

Instantly share code, notes, and snippets.

@jiro4989
Last active December 30, 2017 04:40
Show Gist options
  • Save jiro4989/be89b2ac3da303eb0b9624fbcc5dc60a to your computer and use it in GitHub Desktop.
Save jiro4989/be89b2ac3da303eb0b9624fbcc5dc60a to your computer and use it in GitHub Desktop.
空のダミーファイルを生成するスクリプト(powershell, python, go)
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.")
}
}
0..120 | % {
$num = ([string]$_).PadLeft(3, "0")
echo "" > "ps1\dummy$num.zip"
}
ls ps1
#!/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()
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