Created
August 19, 2016 11:35
-
-
Save petruisfan/d3f154e122fd6a253777fdedeebd269c to your computer and use it in GitHub Desktop.
Generate random archives
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 bash | |
START=0 | |
FILES_NUMBER=10 | |
CWD=$( cd "$( dirname "${BASH_SOURCE[0]}" )/" && pwd ) | |
cd ${CWD} | |
if [[ $# -gt 0 ]]; then | |
FILES_NUMBER="${1}" | |
fi | |
NEW_FOLDER=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 20 | head -n 1) | |
echo "New folder name: $NEW_FOLDER" | |
mkdir $NEW_FOLDER | |
for x in $(eval echo "{0..$FILES_NUMBER}") | |
do | |
head -c 10000 /dev/urandom > $NEW_FOLDER/dummy_$x.txt | |
done | |
zip -r $NEW_FOLDER.zip $NEW_FOLDER/* | |
rm -rf $NEW_FOLDER |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment