Get all file all subfolders and all hidden file with glob

前端 未结 6 1842
故里飘歌
故里飘歌 2020-12-17 23:28

In my recurive function to zip a whole folders i have this piece of code glob($path. \'/*\') that give me all files and subfolders matching my $path.

Here I read

6条回答
  •  不思量自难忘°
    2020-12-18 00:20

    To get all folders/files (even the hidden ones):

    $result = glob($path . '{,.}[!.,!..]*',GLOB_MARK|GLOB_BRACE);
    

    This will prevent listing "." or ".." in the result.

提交回复
热议问题