By default, the CLI writes the converted output to the same directory as the input file and with the same name as the input file, except with a file extension that matches the output format (e.g., replacing .adoc with .html).
You can override this default and have the CLI write to a file and directory of your choice.

There are several circumstances when you'll want to specify a different output file:

* You want to write the output file to a different name, perhaps to append a qualifier such as a version string.
* You want to write the output file to a different directory.
* You are piping content to the CLI, but want to write the output to a file (in this case, an output file is required).

NOTE: By specifying an output file, you implicitly overwrite the output directory as well.
The output file will be resolved relative to the current working directory, not the directory of the input file.

To specify the output file, you'll use the `-o` option.
For example, let's say we want to convert [.path]_mydoc.adoc_ and write the output to a filename that includes the current date.
You'd use:

 $ asciidoctor -o mydoc-$(date +%Y-%m-%d).html mydoc.adoc

We could write it to another folder as well by prefixing the output file with a folder name:

 $ asciidoctor -o build/mydoc-$(date +%Y-%m-%d).html mydoc.adoc

If you only want to specify the output directory, but let the filename be defaulted, use the `-D` option:

 $ asciidoctor -D build mydoc.adoc

The `-D` option can also be used when processing multiple input files:

 $ asciidoctor -D build *.adoc

If you are piping content to the CLI, the default is to write the output to STDOUT.
If you want to write the output to a file in this case, you have to specify one:

 $ cat mydoc.adoc | asciidoctor -o build/mydoc-$(date +%Y-%m-%d).html -

You'll learn more about piping content through the CLI in the next section.
