mktouch = make directory + make file

A quick bash utility to make it fast and easy to create a new file within a new directory

Jun 28, 2024

This is a simple zsh script to help create a blank file, along with any missing folders. This allows for both a file and its folders to be created in a single command:

mktouch() {
  if [ -z "$1" ]; then
    echo "Usage: mktouch <filename>"
    return 1
  fi

  mkdir -p "$(dirname "$1")" && touch "$1"
}

An example usage of this would be:

 mktouch src/muscles/models/_prompts/MuscleModel.tsx.prompt