Other [RESOLVED] Anyone know of a script (perhaps Perl or some other scripter) that can
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: [RESOLVED] Anyone know of a script (perhaps Perl or some other scripter) that can

  1. #1
    Join Date
    Nov 2010
    Posts
    125

    [RESOLVED] Anyone know of a script (perhaps Perl or some other scripter) that can

    take the output of the command dir /S > file1.out and dir /S > file2.out (ie. those two files) and make a 3rd file or at least print to the screen so I can redirect it that shows only the differences in those two files.

    This would be easy in C++ - just read in each line, compare the strings, and only print out if they are not the same. Easy.

    But I want this done with a script if possible. And it has to be on Windows 10 because the files are too big to email. They are about 100 MB+.

    This way I can tell exactly what files have changed after installing a piece of software.

    If I don't here back, I'll probably just write something. But I'm not sure I have Perl on my Windows machine. Or much from the Linux utilities.

    Just curious if this kind of tool has been gifted over to the user world or do I have to roll my own.

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    5,700

    Re: Anyone know of a script (perhaps Perl or some other scripter) that can

    From the command prompt you could use fc to compare the 2 files.

    Code:
    c:\MyProgs>fc /?
    Compares two files or sets of files and displays the differences between
    them
    
    
    FC [/A] [/C] [/L] [/LBn] [/N] [/OFF[LINE]] [/T] [/U] [/W] [/nnnn]
       [drive1:][path1]filename1 [drive2:][path2]filename2
    FC /B [drive1:][path1]filename1 [drive2:][path2]filename2
    
      /A         Displays only first and last lines for each set of differences.
      /B         Performs a binary comparison.
      /C         Disregards the case of letters.
      /L         Compares files as ASCII text.
      /LBn       Sets the maximum consecutive mismatches to the specified
                 number of lines.
      /N         Displays the line numbers on an ASCII comparison.
      /OFF[LINE] Do not skip files with offline attribute set.
      /T         Does not expand tabs to spaces.
      /U         Compare files as UNICODE text files.
      /W         Compresses white space (tabs and spaces) for comparison.
      /nnnn      Specifies the number of consecutive lines that must match
                 after a mismatch.
      [drive1:][path1]filename1
                 Specifies the first file or set of files to compare.
      [drive2:][path2]filename2
                 Specifies the second file or set of files to compare.
    or use comp

    Code:
    c:\MyProgs>comp /?
    Compares the contents of two files or sets of files.
    
    COMP [data1] [data2] [/D] [/A] [/L] [/N=number] [/C] [/OFF[LINE]]
    
      data1      Specifies location and name(s) of first file(s) to compare.
      data2      Specifies location and name(s) of second files to compare.
      /D         Displays differences in decimal format.
      /A         Displays differences in ASCII characters.
      /L         Displays line numbers for differences.
      /N=number  Compares only the first specified number of lines in each file.
      /C         Disregards case of ASCII letters when comparing files.
      /OFF[LINE] Do not skip files with offline attribute set.
    
    To compare sets of files, use wildcards in data1 and data2 parameters.
    Last edited by 2kaud; August 25th, 2017 at 02:05 PM.
    All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/

    C++17 Compiler: Microsoft VS2017 (15.3.4)

  3. #3
    Join Date
    Nov 2010
    Posts
    125

    Re: Anyone know of a script (perhaps Perl or some other scripter) that can

    Thanks, I ran fc on the files - it seems to have showed some proper differences. I just need to examine the files now and see if it ran correctly.

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This a Codeguru.com survey!


On-Demand Webinars (sponsored)