Thread: comparing files and folders

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    20

    comparing files and folders

    Hi,

    I am still a newbie with this.. n i have searched a lot on net to get me something which will help me compare files and folders.. date n time stamp and size.. but instead of a programmatic help they just show the software lists..

    can anybody guide me few steps towards this..

    any help will be highly appreciated.

    Thanx,
    Vivek

  2. #2
    Registered User
    Join Date
    Nov 2002
    Posts
    20
    OS : Win2K
    Compiler : Borland C++ 5.5

  3. #3
    Registered User
    Join Date
    Nov 2002
    Posts
    29
    Look at either the header file io.h or dir.h. I'm not sure which it is for Borland as I am on DevC++ but in either of the two there should be a struct called wither _finddata_t or ffblk which has variables in it that correspond to attributes such as readonly subdir and so forth as well as time created, size, time last accessed, and name. I don't know the specifics yet as I am still learning how to use this header file to do pretty much what you are saying but I believe you would do something along the line of this:

    Code:
    #include<dir.h>
    struct _finddata_t find
    
    /*-----code-----*/
    int done,x=1;
    char *fin="Search Complete";
    done = _findfirst(filename, &find);
    while (done != (-1))
    {
          printf(" File %s occured %d time(s)\n",filename,x++);
          if (done == _A_SUDDIR)
          { /*sub directory constant may be different for your compiler*/
                 chdir(find.name)
                 done = _findnext( done, &find);
                 printf(" File %s occured %d time(s)\n",filename,x++);
           }
          done = _findnext( done, &find);
    }
    _findclose(done);
    puts(fin);
    exit(0);
    }
    That is not the best so will someone else please critique it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. geting full path of files and folders (boost::filesystem)
    By umen242 in forum C++ Programming
    Replies: 2
    Last Post: 05-18-2008, 11:37 PM
  2. Difference between files and folders?
    By fanoliv in forum C Programming
    Replies: 4
    Last Post: 06-20-2006, 09:15 AM
  3. List files in a directory (without folders)
    By 3saul in forum Linux Programming
    Replies: 4
    Last Post: 04-20-2006, 01:08 AM
  4. Batch file programming
    By year2038bug in forum Tech Board
    Replies: 10
    Last Post: 09-05-2005, 03:30 PM
  5. Folders and text files
    By tim545666 in forum C++ Programming
    Replies: 11
    Last Post: 02-17-2002, 04:15 PM