macosfilecommand-lineterminalfile-manager

Create a lot of files of specified size in Terminal (OSX)?


I used this example to create one file:

mkfile -n size[b|k|m|g] filename

mkfile -n 1g ~/Desktop/LargeTestFile

But I need a lot of such files. How to create a lot of files using this command or clone multiple times this one file in Terminal in OSX? I need just any files of approximate specified size


Solution

  • For example the following command creates 9 files of size 99 megabytes and names them x001 - x009:

    for i in {1..9};do mkfile -n 99m x$(printf '%03d' $i);done