Skip to content

Commit 3bd0376

Browse files
committed
README update
1 parent 30840f1 commit 3bd0376

File tree

1 file changed

+69
-1
lines changed

1 file changed

+69
-1
lines changed

README.md

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,69 @@
1-
bash-random_folder_tree
1+
# Create a Random Folder Tree
2+
3+
A bash script that will create a folder tree with files in it.
4+
5+
## Details
6+
7+
Ths folders are named with random letters using `mktemp`, and the files within them are:
8+
* named randomly
9+
* vary in size randomly within a range
10+
* have random extensions taken from an array
11+
12+
## Use Case
13+
14+
The folder tree with files that this script creates is used for testing a zip archive utility.
15+
16+
## Features
17+
18+
These are the features as compared to its [ancestor](https://github.com/eliranbz/bash_create_random_files_and_folders):
19+
* re-factored, now has functions for folder & file creation and for creating the tree that contains them
20+
* removed -
21+
* the "mailer" function
22+
* "script running" check and notification via the "mailer"
23+
* the "Removing Spaces" code, random file contents are no longer filtered
24+
* the MD5 file creation
25+
* quantities of folders and files are now kept in variables
26+
* random file size range is now kept in variables
27+
* the name of the containing folder is now kept in a variable
28+
* the bulk of the `stdout` messages can now be muted
29+
* the tree that is created is deeper than the original
30+
* fixed and added comments
31+
* the current settings will place 30 folders with 310 files in the containing folder
32+
33+
## Settings
34+
35+
```
36+
# settings, maximum folders and files within
37+
NUMRDIRS=5
38+
NUMRFILES=10
39+
40+
# range of random file sizes in bytes
41+
MAXSIZE=10000
42+
MINSIZE=2000
43+
44+
# the containing folder for the random tree
45+
BASENAME=randtree
46+
47+
# extensions for the random files
48+
EXTS=(md log json js php jpg png html css)
49+
```
50+
51+
```
52+
# "mutable" echoing
53+
54+
SILENT=true
55+
mutecho() {
56+
if [ "$SILENT" = true ]; then
57+
return
58+
fi
59+
echo $1
60+
}
61+
```
62+
63+
## Run the Script
64+
65+
This *should* run in most any bash environment. It's been tested under Windows with the Gitbash shell.
66+
67+
## Credits
68+
69+
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)