Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: read all files

  1. #1
    New Coder
    Join Date
    Apr 2007
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts

    read all files

    Hi,

    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.

    PHP Code:
    $file all my files in my images folder or this directory


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

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


  • #2
    New Coder
    Join Date
    Oct 2005
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts
    PHP Code:
    $objHandle opendir($strDir);
    while((
    $strFile readdir($objHandle)))
    {
       if(
    $strFile != ".." && $strFile != ".")
       {
          
    //chmod files here
          
    chmod($strFile0644);
       }
    }
    closedir($objHandle); 

  • #3
    Regular Coder GO ILLINI's Avatar
    Join Date
    Jun 2005
    Location
    USA
    Posts
    634
    Thanks
    0
    Thanked 7 Times in 7 Posts
    you could just exec the regular *nix command
    Code:
    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.

    -Adam
    Why not thank me?

    http://adamsworld.name


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •