Skip to content

Instantly share code, notes, and snippets.

@sdmcraft
Created February 12, 2019 11:31
Show Gist options
  • Select an option

  • Save sdmcraft/be8ad958f5dbcd38a07d2d47afff62a1 to your computer and use it in GitHub Desktop.

Select an option

Save sdmcraft/be8ad958f5dbcd38a07d2d47afff62a1 to your computer and use it in GitHub Desktop.

Revisions

  1. sdmcraft created this gist Feb 12, 2019.
    21 changes: 21 additions & 0 deletions append-garbage.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    #!/bin/bash
    usage()
    {
    echo -e "Usage: $0 -i <input folder path containing files to append garbage> -b <garbage size>" \
    "\nExample Usage: ./append-garbage.sh -i ~/Pictures/000-large -b 10M" 1>&2; exit 1;
    }
    while getopts i:b: option
    do
    case "${option}"
    in
    i) SOURCE_FOLDER=${OPTARG};;
    b) GARBAGE_SIZE=${OPTARG};;
    *) usage;;
    esac
    done
    dd if=/dev/zero of=garbage.dat bs=$GARBAGE_SIZE count=1
    for FILE in $SOURCE_FOLDER/*
    do
    cat garbage.dat >> $FILE
    done
    rm garbage.dat