Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8727203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:23:45+00:00 2026-06-13T08:23:45+00:00

I have read many questions in stackoverflow, related to python compare directory. However, my

  • 0

I have read many questions in stackoverflow, related to python compare directory. However, my current question is bit different.
I have two directories, which contains two different version release package contents. Now I want to compare to ensure the contents are same. However few files have version name embedded into them. Now which is the best possible way to compare them and conclude (except the version difference, all files match).


For example:
Version V1R1C1 contains directory structure as below

pmt> find . -name "*"
.
./c1
./c1/c2
./c1/c1_V1R1C1.cfg
./a1
./a1/a1_V1R1C1.cfg
./a1/a2
./a1/a2/a1a2_V1R1C1.cfg
./b1/a_best_file.txt
./b1/b2/a_test_file.txt
./b1/b2/b1b2_V1R1C1.cfg
./a_V1R1C1.cfg

Version V2R3C1 may contain below structure

pmt> find . -name "*"
.
./c1
./c1/c2
./c1/c1_V2R3C1.cfg
./a1
./a1/a1_V2R3C1.cfg
./a1/a2
./a1/a2/a1a2_V2R3C1.cfg
./b1/a_best_file.txt
./b1/b2/a_test_file.txt
./b1/b2/b1b2_V2R3C1.cfg
./a_V2R3C1.cfg

In the above case, the program must flag it as equivalent structure.

I can think of few solutions – like for example, read both the directory structure recursively into cache (dict), rip the version information and compare etc. But looks like not a completely effective mechanism because of two reason 1. It does not utilize the inbuilt directory compare 2.The multiple read/rip/compare is bound to cost (especially with huge directory tree structure).

I am looking for ideas, which are simple and efficient than the one above.


PS :
1. In case of any difference (except the version unlike the above example), I would like to use the left/right etc to get diffed list.
2. We can assume before hand which is the version name in both directories (like V1R1C1 in first case and V2R3C1 in second case).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T08:23:45+00:00Added an answer on June 13, 2026 at 8:23 am

    how about use set compare?

    set((remove_version(filepath) for filepath in iter_file(dic1))) == set((remove_version(filepath) for filepath in iter_file(dic2)))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My question is in relation this this answer. https://stackoverflow.com/a/8773953/1297775 I have read at many
I have read many StackOverflow questions on the javascript new Date() object when it
I've read this: https://stackoverflow.com/questions/631850/how-do-you-name-your-many-to-many-relationship-tables But my question is a little different. I'm just wondering
I have read many questions about Android, J2ME and RecordStore , but I still
I have read many questions about the facebook login but until not I didnt
I have read many answers to questions about dynamically resizing NSWindows and nothing has
I have read many question about improving the performance of C++ and C code
I have read many fine algorithms for identifying the most significant bit for 32-
I do know there are already many questions on Stackoverflow related to custom error
I have read many suggested questions, but still cannot find out the answer. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.