View Single Post
Old September 18th, 2013, 08:51 AM   #946 (permalink)
palmtree5
Senior Member
 
palmtree5's Avatar
 
Join Date: May 2012
Location: USA
Gender: Male
Posts: 2,744
 
Device(s): HTC One SV, Samsung Galaxy Prevail (retired), Nexus 7 (Gen 1)
Carrier: Boost Mobile

Thanks: 1,655
Thanked 1,462 Times in 754 Posts
Default

Quote:
Originally Posted by jonbanjo View Post
I don't get on well with bash (I dislike the syntax and there seems to me to be a number of "gotchas"). I guess if I had ambitions of being a system admin I'd have to change my ways but for me at home, I'd probably do something like.

PHP Code:
<?php
if (count ($argv) !=2){
  echo 
"Usage zip.php directory\n";
  exit;
}

if (!@
chdir($argv[1])){
  echo 
"Invalid directory\n";
  exit;
}

$logfile "zip.log";
@
unlink($logfile);
foreach (
glob("*"GLOB_ONLYDIR GLOB_MARK) as $dir){
  
$name basename($dir);
  
exec("zip -r \"$dir$name.zip\" \"$dir\" &>>$logfile");
}
?>
There are other shells...
__________________
Find a post helpful? Hit
See spam or something offensive? Hit
New to the site? Site Rules/Guidelines and Introductions
Not a member yet but want to join? Join here!
Let's cure cancer with our phones
palmtree5 is online now  
Reply With Quote