Dear All,
I am developing a Lease Management System and I have Stored LEase agreements in Folder Named LAPO
I used ID for search.
and in LAPO Folder I have created folders name like 9624
inside 9624, I have stored LA.pdf
There are 2300 folders in LAPO
and 95% of the Folders have LA inside.
1. I want to count these LA.pdf through PHP command or function.
Thanks.
2. Also I want the folder name in which LA.pdf exists.

Dear All,
I am developing a Lease Management System and I have Stored LEase agreements in Folder Named LAPO
I used ID for search.
and in LAPO Folder I have created folders name like 9624
inside 9624, I have stored LA.pdf
There are 2300 folders in LAPO
and 95% of the Folders have LA inside.
1. I want to count these LA.pdf through PHP command or function.
Thanks.
2. Also I want the folder name in which LA.pdf exists.

something like this should work for you -

<?php
$count = 0;
if($handle = opendir('/path/to/dir/LAPO'))
{
    echo "Directory handle: $handle\n";
    echo "Files:\n";

    /* This is the correct way to loop over the directory. */
    while (false !== ($file = readdir($handle)))
	{
		is_dir($file)
		{
			if($handle_inner = opendir($file))
			{
					
				while(false !== ($file_inner = readdir($handle_inner)))
				{
					echo "$file\n";
					if($file_inner=='LA.pdf')
					{ $count++;	}
				
				}
			}
		
		}//is_dir
    }

    closedir($handle);
}
echo "Number of LA.pdf found inside".$count;
?>

ask the clarification if any more modification needed

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.