]> git.r.bdr.sh - rbdr/dotfiles/blob
2602e631602da91e7730782bd29237e7cedf8be9
[rbdr/dotfiles] /
1 #!/bin/bash
2
3 set -e
4
5 files=10
6 folders=2
7 depth=4
8 target="$PWD/target"
9
10 rm -rf target
11
12 fill () {
13 local depth=$1
14 local files=$2
15 local folders=$3
16 local target=$4
17
18 if ! [ -d $target ]; then
19 mkdir -p $target
20 fi
21
22 local f
23
24 f=$files
25 while [ $f -gt 0 ]; do
26 touch "$target/f-$depth-$f"
27 let f--
28 done
29
30 let depth--
31
32 if [ $depth -le 0 ]; then
33 return 0
34 fi
35
36 f=$folders
37 while [ $f -gt 0 ]; do
38 mkdir "$target/folder-$depth-$f"
39 fill $depth $files $folders "$target/d-$depth-$f"
40 let f--
41 done
42 }
43
44 fill $depth $files $folders $target
45
46 # sanity assert
47 [ -d $target ]