hi,
i have a text file with some text like index.php_2536
index.php is a file name and 2536 is index.phpfile size
my name.txt file like this
(files/edit_profile.php_36092_files/forget_password.php_3707_files/includ.php_144_files/New Folder/New Folder/New Folder/check.php_1168_files/New Folder/New Folder/notfound.php_902_files/New Folder/New Folder/pagination_interface.php_1461_files/New Folder/notfound.php_902_files/New Folder/pagination_interface.php_1461_files/notfound.php_902_files/pagination_interface.php_1461_files/show_Rss/getrss.php_1565_)
and i have another txt file
name is check.txt
he also have same method data (like name.txt)
if in name.txt (files/edit_profile.php_36092)
and
if in check.txt (files/edit_profile.php_(not same above))
(this is a one check i want full txt check in loop if any size is not same then hi give me file path (also have size like files/edit_profile.php) in a variable 1 or more only how not match )
then hi send to email i don work in email - only want checking function
hi aadi,
i'm not sure i understand the question.
you have a text file that stores file sizes.
you then have another text file that also stores file sizes, and you want to read from both and compare sizes. is that right?
maybe a little more information on why you've structured the data that way, and what you're trying to achieve might help us help you.
cheers
CTB
Oh Lord, please help me be the person my dog thinks I am.
First off, i am assuming that your code produces two text files with the same number of records in the same order. Secondly, your text files need to have proper delimiters in order to separate the data once its ina long giant string. I took the liberty in my code with altering your delimiters:
The complete records that includes the directory, file name, and size are separated by a > and the file size and directory is separated by a ~ in order to properly separate it without messing up file names that have the _ in them.
if($master_fs_data_size != $compare_fs_data_size){ echo 'You have a file size mismatch for file '.$master_fs_data_name.' in directory '.$master_fs_data_directory.' with the original size being '.$master_fs_data_size.' and the compare size being '.$compare_fs_data_size; }
$loopstart++; }
Though i'd have to say a database method would be more appropriate and less hacky than this. If you can, use a database and simply have 4 fields:
Id
Filename
Directory
Size
You can then have your script lookup the file sizes at runtime and compare them with the ones in the database table. This would also be less error prone, because with a delimited text file, if one record is missing, all proceeding files will be reported as having a mismatch.
Last edited by Jarrod1937; 04-08-2010 at 07:07 PM.
Bookmarks