0

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.

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by network18
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.