Results 1 to 3 of 3

Thread: How to exclude a file from being in the listed dir files ?

  1. #1
    Join Date
    Dec 2010
    Posts
    30
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Exclamation How to exclude a file from being in the listed dir files ?

    I have set-up a script to list all the files on a folder. however as the script file is also in the same dir it is listing that too. How would i be able to filter out items from being listed ?

  2. #2
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default

    Depending on how you're doing it, you can just do something like:

    PHP Code:
    <?php
    foreach($files as $file) {
      
      if(
    $file != 'SCRIPT_NAME.php') {
        
    // Do whatever
      
    }

    }
    ?>
    You could probably use the $_SERVER variable to get this, but as long as you don't mind hard coding it, it's all good.

  3. #3
    Join Date
    Dec 2010
    Posts
    30
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Thanks

Bookmarks

Posting Permissions

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