Compare a text file containing file names with files in a folder


  1. Posts : 59
    windows 10
       #1

    Compare a text file containing file names with files in a folder


    Hi,
    I have a text files containing a list of file names and I wish to compare that to a folder with files in it.
    The folder contains a rather large number of files and I want to see if files in that folder exist in the file with the list of file names.

    Hope I have explained my problem clearly.

    Would appreciate any help
    Thanks
      My Computer


  2. Posts : 42,982
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #2

    Hi, can only think you'd need to create a simple script.

    First create a file containing a textual representation of just the file names in the folder.
    (That's one line using a DIR command, for example).

    Then use e.g.
    https://www.diffchecker.com/

    Just an idea..

    There are many option for comparing text files:
    How To Compare Two Text Files Using Notepad++
    Text Compare! - An online diff tool that can find the difference between two texts
    WinMerge - You will see the difference…


    That might work if the two files contain ordered lists, one item per line.

    If the files are for some reason radically different in format and layout, you would need to create your own search and compare script.
      My Computers


  3. Posts : 59
    windows 10
    Thread Starter
       #3

    Hi Dalchina,

    Many thanks for your help.
    I am much nearer now, I have 2 text files containing the files in each directory, however one is not in alphabetical order.
    ave used the command line Sort command but the output duplicates each line.
    Until I can resolve this all the compare apps fail.

    Many Thanks
      My Computer


  4. Posts : 42,982
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #4

    Hi, regarding the DIR command, if it's that one that needs sorting,
    DIR <source> /O /B > <output file>
    sorts appropriately

    For an existing text file e.g.
    Sort a list alphabetically - Office Support
    Sort Lines Alphabetically
    Last edited by dalchina; 29 Jan 2019 at 01:14.
      My Computers


  5. Posts : 59
    windows 10
    Thread Starter
       #5

    Hi Dalchina,

    Thanks again,

    Solved my sort problem, got rid of the duplicates.
    Now have 2 alphabetically sorted text files which I compared using Notepad++

    This gave me the info I needed.

    Regards
      My Computer


  6. Posts : 42,982
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #6

      My Computers


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 10:10.
Find Us




Windows 10 Forums