I have a directory which has say 10 .txt files. Open the directory using:
$dir_handle = @opendir($path) or die("Unable to open $path");
I need to be able to read the files names of the text files, and then write all those file names to a master list with a | after each file name. I also do not want the masterlist.txt to be written inside itself lol. So the masterlist.txt is what is being written to with the file names of the .txt files.
Loop over the directory with
readdir(), and verify that each entry isn’t the master list or.or... Write it to the file withfile_put_contents().If you only want
.txtfiles, use something like: