Tiny Deathstars of Foulness

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})

July 13th, 2015

Posted In: Mac OS X, Mac OS X Server, Mac Security, Ubuntu, Unix

Tags: , , , ,

  • fakereader

    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

  • Pingback: Removing Those Thousands Of Empty Directories In Bash |

  • scnd

    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}