PHP: if(is_dir($this->getServer()->getDataPath()."players")){ $dirPath = $this->getServer()->getDataPath()."players"; foreach(scandir($dirPath) as $object){ $explode = explode(".", $object); if($explode[1] == "dat"){ var_dump($explode[0]); } } }
No, you have to scandir the directory, then make a foreach loop for the files in the array and then you can parse the files and get the values from it.
PHP: $files = glob("path/to/folder/*.dat");// The $files var will contain array of file paths with extension .dat
It is a very inefficient task to open a large number of files to get little data per file. Create an index file if you need to do this frequently. An SQLite3 database is a good option to do so.