Create a temporary directory.
172103
public File createDirectorySync(String prefix) throws IOException {
		Path path = Files.createTempDirectory(tempDir.toPath(), this.prefix + prefix);
		File dir = path.toFile();
		/*
		app.toClose(new Closeable() {
			@Override
			public void close() {
				new RemoveDirectoryTask(dir, null, 0, null, Task.PRIORITY_NORMAL, false).start();
			}
		});*/
		return dir;
	}
342037
def mktemp_file(self):
        
        if not(os.path.exists(self.__dirname)):
            logging.debug("Creating directory {}".format(self.__dirname))
            os.mkdir(self.__dirname)
        elif not(os.path.isdir(self.__dirname)):
            raise TempDirIsFileException(
                "There is a file called %s in this directory!!!" %
                self.__dirname)
        #self.fdesc, self.fname = tempfile.mkstemp(dir=self.__dirname, text=True)
        self.f = tempfile.NamedTemporaryFile(dir=self.__dirname, delete=False, mode="wt")
        logging.debug("Creating file {}".format(self.f.name))
1143851
def with_temp_dir(dir=nil)
      dir ||= Dir.mktmpdir(TEMP_PREFIX, @temp_root)
      dir = Pathname.new(dir)

      yield dir
    ensure
      FileUtils.rm_rf(dir.to_s)
    end
848218
def mk_dir(self) :
        """"""
        if not os.path.exists(self.abs) :
            os.makedirs(self.abs)
1237819
def _cleanup_tempdir(tempdir):
    """"""
    try:
        shutil.rmtree(tempdir)
    except OSError as err:
        if err.errno != errno.ENOENT:
            raise
798348
def create_tmp_rootdir(self):
        
        if self.rootdir:
            tmp_rootdir = tempfile.mkdtemp(prefix='bcolz-')
            self._dir_clean_list.append(tmp_rootdir)
        else:
            tmp_rootdir = None
        return tmp_rootdir
1213319
private synchronized File createTemp(File workingDirectory) throws IOException {
        if (workingDirectory == null) {
            return createTempDir();
        }
        else {
            workingDirectory.mkdirs();
            return workingDirectory;
        }
    }
913509
def make_dir(self):
        """"""
        if not os.path.exists(self.dirname):
            os.makedirs(self.dirname)
946244
def create_dir(dst):
    
    directory = os.path.dirname(dst)
    if directory and not os.path.exists(directory):
        os.makedirs(directory)
891515
def _prepare_temp_dir(self):
    """"""
    if not shell_call(['sudo', 'rm', '-rf', os.path.join(self._temp_dir, '*')]):
      logging.error('Failed to cleanup temporary directory.')
      sys.exit(1)
    # NOTE: we do not create self._extracted_submission_dir
    # this is intentional because self._tmp_extracted_dir or it's subdir
    # will be renames into self._extracted_submission_dir
    os.mkdir(self._tmp_extracted_dir)
    os.mkdir(self._sample_input_dir)
    os.mkdir(self._sample_output_dir)
    # make output dir world writable
    shell_call(['chmod', 'a+rwX', '-R', self._sample_output_dir])
1025672
def _cleanup_temp_dir(self, base_dir):
        """"""
        if self._should_cleanup_temp_dir:
            logging.debug('Cleaning up temporary directory %s.', base_dir)
            if self._user is None:
                util.rmtree(base_dir, onerror=util.log_rmtree_error)
            else:
                rm = subprocess.Popen(self._build_cmdline(['rm', '-rf', '--', base_dir]),
                                      stderr=subprocess.PIPE)
                rm_output = rm.stderr.read().decode()
                rm.stderr.close()
                if rm.wait() != 0 or rm_output:
                    logging.warning("Failed to clean up temp directory %s: %s.",
                                    base_dir, rm_output)
        else:
            logging.info("Skipping cleanup of temporary directory %s.", base_dir)
1087706
def tempdir(fun):
    '''

    '''
    def wrapper(*args, **kwargs):
        self = args[0]
        if os.path.isdir(self._tempdir):
            shutil.rmtree(self._tempdir)
        self._tempdir = tempfile.mkdtemp()
        # If the method raises an exception, delete the temporary dir
        try:
            retval = fun(*args, **kwargs)
        finally:
            shutil.rmtree(self._tempdir)
        if os.path.isdir(self._tempdir):
            shutil.rmtree(self._tempdir)
        return retval
    return wrapper
745167
@Deprecated
    public static File createTempDirectory( final String    prefix )
        throws
            IOException
    {
        File tempDir;

        tempDir = File.createTempFile( prefix, null );

        if( ! ( tempDir.delete() ) )
        {
            throw new IOException( "Could not delete temp file: " + tempDir.getAbsolutePath() );
        }

        if( ! ( tempDir.mkdir() ) )
        {
            throw new IOException( "Could not create temp directory: " + tempDir.getAbsolutePath() );
        }

        return tempDir;
    }
306236
def tempdir(*args, **kwargs):
    

    d = tempfile.mkdtemp(*args, **kwargs)
    try:
        yield d
    finally:
        shutil.rmtree(d)
959510
public static File createTempDir(String prefix) {
    File baseDir = new File(System.getProperty("java.io.tmpdir"));
    String baseName = prefix + System.currentTimeMillis() + "-";

    for (int counter = 0; counter < 10000; counter++) {
      File tempDir = new File(baseDir, baseName + counter);
      if (tempDir.mkdir()) {
        return tempDir;
      }
    }
    throw new IllegalStateException(
        "Failed to create directory within " + 10000 + " attempts (tried " + baseName + "0 to " + baseName + (10000 - 1)
            + ')');
  }
74734
public static File createTempDirectory(String _path, String _name, boolean _deleteOnExit) {

        File outputDir = new File(concatFilePath(_path, _name));
        if (!outputDir.exists()) {
            try {
                Files.createDirectory(Paths.get(outputDir.toString()));
            } catch (IOException _ex) {
                LOGGER.error("Error while creating temp directory: ", _ex);
            }
        } else {
            return null;
        }
        if (_deleteOnExit) {
            outputDir.deleteOnExit();
        }
        return outputDir;
    }
993741
def EnsureTempDirIsSane(directory):
  """"""

  if not os.path.isabs(directory):
    raise ErrorBadPath("Directory %s is not absolute" % directory)

  if os.path.isdir(directory):
    # The temp dir already exists, we probably created it already but
    # let's check to make sure.
    if not client_utils.VerifyFileOwner(directory):
      # Just delete it, it's only temp dirs and we don't own it. If
      # this goes wrong we just raise.
      shutil.rmtree(directory)

  if not os.path.isdir(directory):
    os.makedirs(directory)

    # Make directory 700 before we write the file
    if sys.platform == "win32":
      from grr_response_client import client_utils_windows  # pylint: disable=g-import-not-at-top
      client_utils_windows.WinChmod(directory,
                                    ["FILE_GENERIC_READ", "FILE_GENERIC_WRITE"])
    else:
      os.chmod(directory, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR)