Results 1 to 4 of 4

Thread: check txt file

  1. #1
    Join Date
    Dec 2009

    check txt file

    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)
    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

    thanx in advance............
    Last edited by aadi; 04-08-2010 at 10:04 AM.

  2. #2
    Join Date
    Aug 2003
    Sydney, Australia
    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.
    Oh Lord, please help me be the person my dog thinks I am.

  3. #3
    Join Date
    Mar 2010
    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.
    PHP Code:


    $loopstart <= (count($master_fs)-1)){

    // ------------------------ //


    $master_fs_data_size != $compare_fs_data_size){
    '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;


    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:

    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.

  4. #4
    Join Date
    Dec 2009
    Thanx Bro its working
    thanx again

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center