Skip to content

KonstantinaStoikou/create-file-hierarchy-script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Create a hierarchy of random files and subdirectories

Run as :

./create_infiles.sh dir_name num_of_files num_of_dirs levels

where :

  • dir_name : the name of the directory to create everything inside. CAUTION if directory already exists it will erase it and create a new empty one!
  • num_of_files : the total number of files to be created
  • num_of_dirs : the total number of directories to be created
  • levels : the number of levels to distribute the directories (the heighest depth of a subdirectory)

1. Create directories with names with random numbers and characters of length 1-8 and distribute them to the given levels (depth of subdirectories).

For example if num_of_dirs=5 and levels=3 the directories will be created as:
thedir/zs2lW3nn
thedir/zs2lW3nn/pKbkBm
thedir/zs2lW3nn/pKbkBm/3
thedir/pUMy8K
thedir/pUMy8K/Ww4

2. Create files with names with random numbers and characters of length 1-8 and write in them a random string (numbers and characters) with size 1-128 kb. Distribute them in a round-robin order to the subdirectories.

For example if num_of_files=8 :
thedir/5Brt7w
thedir/zs2lW3nn/TtrgE6
thedir/zs2lW3nn/pKbkBm/791PBb
thedir/zs2lW3nn/pKbkBm/3/Qg
thedir/pUMy8K/xIUcAZ9C
thedir/pUMy8K/Ww4/wvPOWxLF
thedir/R
thedir/zs2lW3nn/Ch224y

Releases

No releases published

Packages

No packages published

Languages