Penguin-KarChunTKarChunT

Task Directory

Learn how to run tasks from a specific directory

We know that tasks are run in the current directory where the Taskfile is located. However, you can actually run the Taskfile tasks in another directory by using the dir keyword.

Taskfile.yml
version: '3'
tasks:
  get-working-directory:
    dir: ./app1
    cmds:
      - pwd

If the directory does not exist, Task will create it.

Demo and output
ubuntu@touted-mite:~$ task get-working-directory 
task: [get-working-directory] pwd
/home/ubuntu/app1