1#!/bin/bash 2 3# creates local file for uploading directories to s3 bucket under $HOME/tm_dir_file 4 5if [[ ! -d ~/tm_dir_files ]]; 6then 7 echo "mkdir $HOME/tm_dir_files" 8 mkdir ~/tm_dir_files 9fi 10 11if [[ ! -d ~/tm_dir_files/1B ]]; 12then 13 echo "mkdir $HOME/tm_dir_files/1B" 14 mkdir ~/tm_dir_files/1B 15fi 16 17if [[ ! -d ~/tm_dir_files/4K ]]; 18then 19 echo "mkdir $HOME/tm_dir_files/4K" 20 mkdir ~/tm_dir_files/4k 21fi 22if [[ ! -d ~/tm_dir_files/16M ]]; 23then 24 echo "mkdir $HOME/tm_dir_files/16M" 25 mkdir ~/tm_dir_files/16M 26fi 27 28if [[ ! -d ~/tm_dir_files/5G ]]; 29then 30 echo "mkdir $HOME/tm_dir_files/5G" 31 mkdir ~/tm_dir_files/5G 32fi 33 34if [[ "$1" == 1B ]]; then 35 for i in {1..1000}; do 36 dd if=/dev/urandom of=~/tm_dir_files/1B/"$i" bs=1 count=1 status=none 37 done 38 exit 39fi 40 41if [[ "$1" == 4K ]]; then 42 for i in {1..1000}; do 43 dd if=/dev/urandom of=~/tm_dir_files/4KB/"$i" bs=4096 count=1 status=none 44 done 45 exit 46fi 47 48if [[ "$1" == 16M ]]; then 49 for i in {1..1000}; do 50 dd if=/dev/urandom of=~/tm_dir_files/16MB/"$i" bs=16777216 count=1 status=none 51 done 52 exit 53fi 54 55if [[ "$1" == 5G ]]; then 56 for i in {1..100}; do 57 dd if=/dev/urandom of=~/tm_dir_files/5GB/"$i" bs=5G count=1 status=none 58 done 59 exit 60fi 61 62echo "usage:" 63echo " create_benchmark_directory_files 1B|4K|16M|5G" 64 65