I used glob() function in my application which is hosted on Google App Engine and my text_files are on Google Cloud Storage. It doesn't work and return false. Here is the code:
$links = glob("gs://bucket_name/folder/textfile_*");
if($links){
echo "true \n";
print_r($links);
}else{
echo "false";
}
And my files on GCS are like this:
textfile_Ben.txt
textfile_Sam.txt
textfile_David.txt
I checked the http://php.net/manual/en/function.glob.php and it says:
Note: This function will not work on remote files as the file to be examined must be accessible via the server's filesystem.
My application works fine with other functions such file_get_contents()
or file_put_contents()
.
Question:
Is there any solution for using glob()
function or is there any alternate method to do the same functionality?
I have got the solution :)
cheers
Use opendir/readdir and filter the paths yourself.