Skip to content

Commit 4daead5

Browse files
committed
README update
1 parent fbeaa91 commit 4daead5

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,20 @@ BASENAME=randtree
5050
EXTS=(md log json js php jpg png html css)
5151
```
5252

53+
```
54+
# optional, will increment a count for each EXTS used and
55+
# show it at the end
56+
INVEN=true
57+
# this will use the EXTS array to build an array of counters
58+
if [ "$INVEN" = true ]; then
59+
declare -A ext_inven
60+
for ext in "${EXTS[@]}"
61+
do
62+
ext_inven+=(["$ext"]=0)
63+
done
64+
fi
65+
```
66+
5367
```
5468
# "mutable" echoing
5569
SILENT=true
@@ -68,6 +82,35 @@ This *should* run in most any bash environment. It's been tested under Windows w
6882

6983
**NOTE:** Copy the script into a folder where you want the tree to be created. The script will create a *new* folder with the tree inside of it. The new folder will be named with the value of `BASENAME` in the script.
7084

85+
### Output Example
86+
87+
```
88+
$ ./randtree.sh
89+
Creating 5 random files in /scrap/recursmall_sub/recursmall_sub
90+
Creating 2 random folders in /scrap/recursmall_sub/recursmall_sub
91+
Creating 5 random files in /scrap/recursmall_sub/recursmall_sub/JayWb6z
92+
Creating 5 random files in /scrap/recursmall_sub/recursmall_sub/vFHfuNs
93+
Creating 2 random folders in /scrap/recursmall_sub/recursmall_sub/JayWb6z
94+
Creating 5 random files in /scrap/recursmall_sub/recursmall_sub/JayWb6z/1TU6tMN
95+
Creating 5 random files in /scrap/recursmall_sub/recursmall_sub/JayWb6z/KK4TXlF
96+
Creating 2 random folders in /scrap/recursmall_sub/recursmall_sub/vFHfuNs
97+
Creating 5 random files in /scrap/recursmall_sub/recursmall_sub/vFHfuNs/L5eKZ4y
98+
Creating 5 random files in /scrap/recursmall_sub/recursmall_sub/vFHfuNs/T3ANT2x
99+
Finshed in /scrap/recursmall_sub/recursmall_sub
100+
101+
File Inventory
102+
[html] = 2
103+
[jpg] = 3
104+
[log] = 4
105+
[txt] = 5
106+
[js] = 2
107+
[json] = 6
108+
[php] = 3
109+
[css] = 5
110+
[md] = 2
111+
[png] = 3
112+
```
113+
71114
## Credits
72115

73116
The original source was obtained from https://github.com/eliranbz/bash_create_random_files_and_folders. It provided insight into `mktemp()` and `/dev/urandom`.

0 commit comments

Comments
 (0)