Create a temporary directory under a given workspace
181318
public static FilePath createAndGetTempDir(final FilePath ws) throws IOException, InterruptedException {
        // The token that combines the project name and unique number to create unique workspace directory.
        String workspaceList = System.getProperty("hudson.slaves.WorkspaceList");
        return ws.act(new MasterToSlaveCallable<FilePath, IOException>() {
            @Override
            public FilePath call() {
                final FilePath tempDir = ws.sibling(ws.getName() + Objects.toString(workspaceList, "@") + "tmp").child("artifactory");
                File tempDirFile = new File(tempDir.getRemote());
                tempDirFile.mkdirs();
                tempDirFile.deleteOnExit();
                return tempDir;
            }
        });
    }
1301998
def temp_directory(*args, **kwargs):
    

    path = tempfile.mkdtemp(*args, **kwargs)
    try:
        yield path
    finally:
        shutil.rmtree(path)
267257
def _prepare_workdir(self):
    """"""
    pants_jar_base_dir = os.path.join(self.versioned_workdir, 'cache')
    safe_mkdir(pants_jar_base_dir)
    return pants_jar_base_dir
56568
public static File createTempDirectory(String prefix, Path dir) throws IOException {
        if (prefix == null) {
            prefix = "";
        }
        final File file = generatePath(prefix, dir).toFile();
        if (!file.mkdirs()) {
            throw new IOException("Can't create dir " + file.getAbsolutePath());
        }
        return file;
    }
840885
def MakeDir(self, path="temp"):
        
        full_path = _os.path.join(self.path_home, path)

        # only make it if it doesn't exist!
        if not _os.path.exists(full_path): _os.makedirs(full_path)
946244
def create_dir(dst):
    
    directory = os.path.dirname(dst)
    if directory and not os.path.exists(directory):
        os.makedirs(directory)
186621
def set_tmp_folder():
    
    output = "%s" % datetime.datetime.now()
    for char in [' ', ':', '.', '-']:
        output = output.replace(char, '')
    output.strip()
    tmp_folder = os.path.join(tempfile.gettempdir(), output)
    return tmp_folder
543543
def create_tempdir
      token = loop do
        # generate random dirnames until we find one that
        # doesn't exist
        test_token = SecureRandom.hex
        break test_token unless File.exist? test_token
      end
      Dir.mkdir(token)
      @last_tempdir = token
      token
    end
903753
private void postWorkDirectory() {

        // Acquire (or calculate) the work directory path
        String workDir = getWorkDir();
        if (workDir == null || workDir.length() == 0) {

            // Retrieve our parent (normally a host) name
            String hostName = null;
            String engineName = null;
            String hostWorkDir = null;
            Container parentHost = getParent();
            if (parentHost != null) {
                hostName = parentHost.getName();
                if (parentHost instanceof StandardHost) {
                    hostWorkDir = ((StandardHost)parentHost).getWorkDir();
                }
                Container parentEngine = parentHost.getParent();
                if (parentEngine != null) {
                   engineName = parentEngine.getName();
                }
            }
            if ((hostName == null) || (hostName.length() < 1))
                hostName = "_";
            if ((engineName == null) || (engineName.length() < 1))
                engineName = "_";

            String temp = getBaseName();
            if (temp.startsWith("/"))
                temp = temp.substring(1);
            temp = temp.replace('/', '_');
            temp = temp.replace('\\', '_');
            if (temp.length() < 1)
                temp = ContextName.ROOT_NAME;
            if (hostWorkDir != null ) {
                workDir = hostWorkDir + File.separator + temp;
            } else {
                workDir = "work" + File.separator + engineName +
                    File.separator + hostName + File.separator + temp;
            }
            setWorkDir(workDir);
        }

        // Create this directory if necessary
        File dir = new File(workDir);
        if (!dir.isAbsolute()) {
            String catalinaHomePath = null;
            try {
                catalinaHomePath = getCatalinaBase().getCanonicalPath();
                dir = new File(catalinaHomePath, workDir);
            } catch (IOException e) {
                logger.warn(sm.getString("standardContext.workCreateException",
                        workDir, catalinaHomePath, getName()), e);
            }
        }
        if (!dir.mkdirs() && !dir.isDirectory()) {
            logger.warn(sm.getString("standardContext.workCreateFail", dir,
                    getName()));
        }

        // Set the appropriate servlet context attribute
        if (context == null) {
            getServletContext();
        }
        context.setAttribute(ServletContext.TEMPDIR, dir);
//        context.setAttributeReadOnly(ServletContext.TEMPDIR);
    }
381017
public static Resource temporaryDirectory() {
      File tempDir = new File(SystemInfo.JAVA_IO_TMPDIR);
      String baseName = System.currentTimeMillis() + "-";
      for (int i = 0; i < 1_000_000; i++) {
         File tmp = new File(tempDir, baseName + i);
         if (tmp.mkdir()) {
            return new FileResource(tmp);
         }
      }
      throw new RuntimeException("Unable to create temp directory");
   }
1193119
def create(self):
        
        if self.path is not None:
            logger.debug(
                "Skipped creation of temporary directory: {}".format(self.path)
            )
            return
        # We realpath here because some systems have their default tmpdir
        # symlinked to another directory.  This tends to confuse build
        # scripts, so we canonicalize the path by traversing potential
        # symlinks here.
        self.path = os.path.realpath(
            tempfile.mkdtemp(prefix="pip-{}-".format(self.kind))
        )
        self._register_finalizer()
        logger.debug("Created temporary directory: {}".format(self.path))
1088427
public static function createWorkingDirectory()
    {
        $workdir = sys_get_temp_dir() . '/tmp-' . session_id() . '/';

        self::recursiveMkdir($workdir, 0777);
        //@chmod($workdir,0777);

        if (!is_dir($workdir)) {
            throw new Exception("cannot create directory: " . $workdir);
        }

        return $workdir;
    }
1071892
def set_workdir(self, workdir, chroot=False):
        
        if not chroot and hasattr(self, "workdir") and self.workdir != workdir:
            raise ValueError("self.workdir != workdir: %s, %s" % (self.workdir,  workdir))

        # Directories with (input|output|temporary) data.
        self.workdir = os.path.abspath(workdir)
        self.indir = Directory(os.path.join(self.workdir, "indata"))
        self.outdir = Directory(os.path.join(self.workdir, "outdata"))
        self.tmpdir = Directory(os.path.join(self.workdir, "tmpdata"))
        self.wdir = Directory(self.workdir)
306236
def tempdir(*args, **kwargs):
    

    d = tempfile.mkdtemp(*args, **kwargs)
    try:
        yield d
    finally:
        shutil.rmtree(d)
1231456
private function prepareTmpDir()
    {
        $tempDir = $this->file->get(self::SETTING_DESTINATION_DIR) . DIRECTORY_SEPARATOR . uniqid('install-');

        // If the temporary folder could not be created, error out.
        // @codingStandardsIgnoreStart - we silence on purpose here as we create an exception on error.
        if (!@mkdir($tempDir, 0700)) {
        // @codingStandardsIgnoreEnd
            throw new \RuntimeException('Could not create the temporary directory');
        }

        $this->tempDir = $tempDir;
    }
1178436
function setupTempDir(tmpDir) {
  var rpmStructure = ['BUILD', 'BUILDROOT', 'RPMS', 'SOURCES', 'SPECS', 'SRPMS'];

  // If the tmpDir exists (probably from previous build), delete it first
  if (fsx.existsSync(tmpDir)) {
    logger(chalk.cyan('Removing old temporary directory.'));
    fsx.removeSync(tmpDir);
  }

  // Create RPM folder structure
  logger(chalk.cyan('Creating RPM directory structure at:'), tmpDir);
  _.forEach(rpmStructure, function(dirName) {
    fsx.mkdirpSync(path.join(tmpDir, dirName));
  });
}
1020288
def _make_tmp_path(self, remote_user=None):
        
        LOG.debug('_make_tmp_path(remote_user=%r)', remote_user)
        path = self._generate_tmp_path()
        LOG.debug('Temporary directory: %r', path)
        self._connection.get_chain().call_no_reply(os.mkdir, path)
        self._connection._shell.tmpdir = path
        return path