Create 10,000 Empty Directories for Testing

The mkdir command is used to create directories. Sometimes, in testing, you need to have a lot of directories. So, you can use the following command to create 10,000 5 digit directories, named 00001 to 10000: mkdir $(printf '%05d\n' {1..10000})

3 thoughts on “Create 10,000 Empty Directories for Testing”

  1. I usually nest 100 subdirs in 100 main dirs – so I’m *not* testing the performance of the file system with lots of entries in one single directory (which is relatively unlikely in real life) but just general heavy dir creation. If that *is* what you want to test, then your code is perfect.

    Something like:

    # Note – first cd to somewhere you can run your test
    for i in {0..99}; do for j in {0..99}; do mkdir -p $i/$j; done ; done

  2. 10000 dirs in one dir

    mkdir -p {00001..10000}

    or 10 dirs with 10 subdirs with 10 subdirs etc… 10000 in summary

    mkdir -p {01..10}/{01..10}/{01..10}/{01..10}

Comments are closed.