View Full Version : read all files

07-25-2007, 01:29 PM

I am trying to chmod all my images in one dir. but I cannot get it to work...
How do I code the first part so it reads all my files I have in the dir?

I want to change all my images cmod settings by running the script once.

$file = all my files in my images folder or this directory

$old = umask(0);
chmod("$file", 0644);

// Checking
if ($old != umask()) {
die('An error occured while changing back the umask');

07-25-2007, 03:49 PM
$objHandle = opendir($strDir);
while(($strFile = readdir($objHandle)))
if($strFile != ".." && $strFile != ".")
//chmod files here
chmod($strFile, 0644);

07-25-2007, 06:49 PM
you could just exec the regular *nix command

chmod -R #### *
that chmod's recursively with #### permissions and on all files in the current directory. Take off the -R to stop it from chmoding subdirectories.


EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum