get folder name

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • waqasahmed996
    New Member
    • Jun 2008
    • 160

    #1

    get folder name

    hi
    i have a folder name themes. i want to get all folders within this folder. can i do this
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hi.

    Sure you can.
    Check out the scandir and is_dir functions.
    They should provide you with what you need to do this.

    Comment

    • waqasahmed996
      New Member
      • Jun 2008
      • 160

      #3
      thanks for providing solution

      there is another way is

      Code:
      $handle = opendir('../themes');
       while (false !== ($file = readdir($handle))) {
              echo $file;
              echo "<br>";
          }

      Comment

      • Atli
        Recognized Expert Expert
        • Nov 2006
        • 5062

        #4
        That would work to, but keep in mind that the readdir() function also returns files.
        If you only want directories, you would want to use the is_dir() function to make sure that the file returned by readdir() is in fact a directory.

        Comment

        Working...