简体   繁体   中英

How to compare two same name files in different directories using meld (without giving their path)?

I know commands:

  1. To find path of file:

     find . -name filename 
  2. To compare two files:

     meld path_of_file_in_one_dir path_of_file_in_second_dir 

I have to compare so many files in different sub directories of a directory, every time I have to first search the path of that file and then use this path with meld , and this I have to for each file.

It would be very easy if i only give names and root directory of that files to meld .

How can I combine meld and find commands so that I can apply it on each file?

  1. If your directory structure is like this say
    • test_folder
      • test1
        • file_to_cmp
      • test2
        • file_to_cmp
      • test3
        • file_to_cmp

then you can run the following

meld find . -name "file*" meld find . -name "file*" or meld find . -name "file_to_cmp" meld find . -name "file_to_cmp"
This will compare the 3 files for sure.
About more than three file comparing, I doubt meld can do it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM