Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is a script that generate a random dir structure :</p> <pre><code>#!/bin/bash # Decimal ASCII codes (see man ascii) ARR=( {48..57} {65..90} {97..122} ) # Array count arrcount=${#ARR[@]} # return a random string get_rand_dir(){ for ((i=1; i&lt;$((RANDOM%30)); i++)) { printf \\$(printf '%03o' ${ARR[RANDOM%arrcount]}); } } dir=/tmp/ # appending random characters to make a hierarchy for ((i=0; i&lt;$((RANDOM%100)); i++)) { dir+="$(get_rand_dir)/" } echo $dir mkdir -p "$dir" oldir=$(echo "$dir" | cut -d '/' -f1-3) while [[ $dir ]]; do dir=${dir%/*} cd $dir for ((i=0; i&lt;$((RANDOM%100)); i++)) { mkdir &amp;&gt;/dev/null -p $(get_rand_dir) } done tree "$oldir" </code></pre> <p><strong>OUTPUT</strong></p> <pre><code>/tmp/x ├── egeDVPW ├── iOkr ├── l ├── o1gye8uF ├── q │   ├── 4Dlrfagv │   ├── 4Yxmoqf │   ├── 8LkyIrXA │   ├── 8m9kse8s │   ├── aV │   ├── in │   │   ├── 12zdLso68HWlPK │   │   │   ├── C │   │   │   ├── DOYt8wUW │   │   │   ├── FXP │   │   │   ├── hFLem8 │   │   │   ├── hhHIv │   │   │   ├── iD87kxs54x04 │   │   │   ├── oFM │   │   │   ├── OjFT </code></pre> <p>Now you can create an array of dirs :</p> <pre><code>shopt -s globstar # require bash4 dirs=( /tmp/x/** ) printf '%s\n' ${dirs[@]} </code></pre> <p>and populate dirs with files randomly. You have enough examples to do so. I've done the most hard work.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload