Creating a Directory: The Mkdir Factory

SCons User Guide 0.98.0
Prev | Chapter 12. Platform-Independent File System Manipulation | Next

# 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] No such file or directory

Prev | Home | Next
Updating the Modification Time of a File: The `Touch` Factory | Up | Changing File or Directory Permissions: The `Chmod` Factory