12.5. Creating a Directory: The Mkdir Factory

If you need to create a directory, use the Mkdir factory. For example, if we need to process a file in a temporary directory in which the processing tool will create other files that we don't care about, you could use:

Command("file.out", "file.in",
        [
          Delete("tempdir"),
          Mkdir("tempdir"),
          Copy("tempdir/${SOURCE.file}", "$SOURCE"),
          "process tempdir",
          Move("$TARGET", "tempdir/output_file"),
          Delete("tempdir"),
        ])
      

Which executes as:

% scons -Q
Delete("tempdir")
Mkdir("tempdir")
Copy("tempdir/file.in", "file.in")
process tempdir
Move("file.out", "tempdir/output_file")
scons: *** [file.out] tempdir/output_file: No such file or directory