Created
October 24, 2019 15:29
-
-
Save psolru/f392a407a9c6e4c4d9e47407e6d97332 to your computer and use it in GitHub Desktop.
creating temp-directory - i use it as a starter in the whisker menu under xubuntu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
function tempName($ext='') { | |
$chars = 'qwertzuiopasdfghjklyxcvbnmQWERTZUIOPASDFGHJKLYXCVBNM1234567890'; | |
$cl = strlen($chars); | |
$l = 30; | |
do { | |
$o = ''; | |
while (strlen($o)<$l) | |
$o .= substr($chars, mt_rand(0,$cl), 1); | |
$file = $o.$ext; | |
} while (file_exists($file)); | |
return $file; | |
} | |
$tmpDir = tempName(); | |
shell_exec('mkdir ~/.temp/'.$tmpDir); | |
shell_exec('nemo ~/.temp/'.$tmpDir); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment