A collection of maintenance scripts for the Sciveyor database.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

26 lines
359 B

#!/bin/bash
# Pull a random sample of txt files into the 'sample' folder for testing.
IFS='
'
files=( `ls *.txt` )
echo "Number of files: ${#files[*]}"
if [ "$#" -eq 0 ]
then
size=10
else
size=$1
fi
[ -e "sample" ] && rm -r sample
mkdir -p sample
for i in $(seq 1 $size)
do
random=$[ $RANDOM % ${#files[*]} ]
cp "${files[$random]}" sample
done