Create a temporary folder using the current time in which
    the zip can be extracted and which should be destroyed afterward.
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
281607
def _CreateTempDir(prefix, run_dir=None):
  
  temp_dir = tempfile.mkdtemp(prefix=prefix + '-', dir=run_dir)
  try:
    yield temp_dir
  finally:
    shutil.rmtree(temp_dir)
610251
@SuppressWarnings("static-method")
	protected File createTempDirectory() {
		final File tmpPath = new File(System.getProperty("java.io.tmpdir")); //$NON-NLS-1$
		int i = 0;
		File tmp = new File(tmpPath, "sarlc" + i); //$NON-NLS-1$
		while (tmp.exists()) {
			++i;
			tmp = new File(tmpPath, "sarlc" + i); //$NON-NLS-1$
		}
		return tmp;
	}
497706
def makeTempFile(self):
        

        if self.strategy == 0:
            try:
                new_delegate = self.STRATEGIES[1]()
                new_delegate.write(self.getvalue())
                self._delegate = new_delegate
                self.strategy = 1
                log.warn("Created temporary file %s", self.name)
            except:
                self.capacity = - 1
1315117
public static final Path createTemporaryVolume(String password) {
        final File tmpFile = new File("target/vnc/.tmp" + System.currentTimeMillis());

        if (!tmpFile.mkdirs()) {
            throw new IllegalArgumentException("Temporary Folder for storing recordings could not be created.");
        }

        Runtime.getRuntime().addShutdownHook(new Thread() {
            @Override
            public void run() {
                FileUtils.deleteQuietly(tmpFile);
            }
        });

        final Path temp = tmpFile.toPath();
        Path passwordFile = temp.resolve("password");

        try {
            Files.write(passwordFile, password.getBytes());
        } catch (IOException e) {
            throw new IllegalArgumentException(e);
        }

        return temp;
    }
1175262
def _default_temporary_directory(self, prefix):
    """"""
    try:
      self.temporary_file = tempfile.NamedTemporaryFile(prefix=prefix)

    except OSError as err: # pragma: no cover
      logger.critical('Cannot create a system temporary directory: '+repr(err))
      raise securesystemslib.exceptions.Error(err)
659240
def delete_old_temp_folders
      path = File.join(Dir.tmpdir, STAGING_AREA_PREFIX + '*')

      day = 24 * 60 * 60
      dirs = Dir.glob(path)
      dirs.select! { |dir| Time.now.utc - File.ctime(dir).utc > day } # only stale ones
      removed = dirs.each { |dir| FileUtils.rm_rf(dir) }

      log "Removed #{removed} old temp folder(s)" if removed.count > 0
    end
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");
   }
134247
def destroyTempDir(self, tempDir):
        
        #Do basic assertions for goodness of the function
        assert os.path.isdir(tempDir)
        assert os.path.commonprefix((self.rootDir, tempDir)) == self.rootDir #Checks file is part of tree
        #Update stats.
        self.tempFilesDestroyed += 1
        #Do the actual removal
        try:
            os.rmdir(tempDir)
        except OSError:
            shutil.rmtree(tempDir)
            #system("rm -rf %s" % tempDir)
        self.__destroyFile(tempDir)
595972
public static Path createTempFolder(String prefix) throws IOException {
		Path parent = Paths.get(System.getProperty("java.io.tmpdir"));
		if (!Files.isDirectory(parent)) {
			throw new IOException("java.io.tmpdir points to a non-existing folder: " + parent);
		}
		Path ret = null;
		int i = 0;
		do {
			ret = parent.resolve(Objects.requireNonNull(prefix)+Long.toHexString(System.currentTimeMillis())+"-"+Integer.toHexString(RND.nextInt()));
			i++;
			if (i>=100) {
				throw new IOException("Failed to create temporary folder.");
			}
		} while (!ret.toFile().mkdirs());
		return ret;
	}
569545
def create_zip(archive, compression, cmd, verbosity, interactive, filenames):
    """"""
    try:
        with zipfile.ZipFile(archive, 'w') as zfile:
            for filename in filenames:
                if os.path.isdir(filename):
                    write_directory(zfile, filename)
                else:
                    zfile.write(filename)
    except Exception as err:
        msg = "error creating %s: %s" % (archive, err)
        raise util.PatoolError(msg)
    return None
688692
def tempfile(self):
        ""
        tf = tempfile.NamedTemporaryFile()
        tfn = tf.name
        tf.close()
        os.remove(tf.name)
        shutil.copy(self.fn, tfn)
        return tfn
202522
public static File createTempFolder(String name) throws Exception {

        File folder = null;
        folder = File.createTempFile(name, "", null);
        folder.delete();
        folder.mkdirs();
        folder.deleteOnExit();
        return folder;
    }
104573
def CleanUp(self, path):
    """"""
    try:
      if os.path.exists(path):
        os.remove(path)
    except (OSError, IOError) as e:
      logging.info("Failed to remove temporary file %s. Err: %s", path, e)
1143350
def createHiddenFolder(self) -> 'File':
        

        if not self._autoDelete:
            raise Exception("Hidden folders can only be created within"
                            " an autoDelete directory")
        return tempfile.mkdtemp(dir=self._path, prefix=".")
742581
public static function checkTemporaryFolder() {
		
		if (!file_exists(static::TEMP_FOLDER) or !is_dir(static::TEMP_FOLDER)) {
			
			// remove any file named as wanted temporary folder
			@unlink(static::TEMP_FOLDER);

			// create the folder
			$old = umask(0);
			if (!mkdir(static::TEMP_FOLDER, 0777, TRUE)) {
				trigger_error('Directory creation on ' . static::TEMP_FOLDER . ' failed');
				$ret = FALSE;
			}
			umask($old);
			
			// sets full permissions
			if (!chmod(static::TEMP_FOLDER, 0777)) {
				trigger_error('Set permissions on directory ' . static::TEMP_FOLDER . ' failed');
				$ret = FALSE;
			}
			
		}
		
	}
471844
def createTempFile(self, suffix=None, prefix=None, secure=True) -> 'File':
        
        if not secure:
            raise NotImplementedError("We only support secure files at this point")

        # tempfile.mkstemp(suffix=None, prefix=None, dir=None, text=False)

        newFileNum, newFileRealPath = tempfile.mkstemp(
            suffix=suffix, prefix=prefix, dir=self._path)
        os.close(newFileNum)

        relativePath = os.path.relpath(newFileRealPath, self.path)

        file = File(self, pathName=relativePath, exists=True)
        self._files[file.pathName] = file
        return file