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 4 of 4
  1. #1
    New Coder
    Join Date
    Sep 2005
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Show all files with prefix admin-

    Hey can someone tell me how I can make it show all files in the current folder that have the prefix admin-? Thanks

  • #2
    Regular Coder
    Join Date
    Oct 2004
    Posts
    330
    Thanks
    0
    Thanked 13 Times in 13 Posts
    http://uk.php.net/manual/en/function.glob.php
    PHP Code:
    chdir('/full/path/from/root/');//go to the directory
    $files glob('admin-*');      //files into an array

    foreach($files as $file)
        {
            echo 
    $file "\n";
        } 

  • #3
    New Coder
    Join Date
    Sep 2005
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'd try :

    PHP Code:
    if( ereg("^admin-"$file) ) { //Insert code for shown files } 

  • #4
    New Coder
    Join Date
    Sep 2005
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I got it to work with schleppel's code. Thanks guys.
    ForumLaunch Staff: We post on your forum


  •  

    Posting Permissions

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