473,657 Members | 2,538 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to compare two directories?

I want to compare 2 directories,
and find If all of theire sub-folders and files and sub-files are identical..
If not the same, I want know which files or folders are not the same.
I know filecmp moudle has cmpfiles function and a class named dircmp,
they may help, but I wonder if there is a ready-to-use function in python libs?
If not, would somebody like to give me some propositions?

Thank you.
Jul 19 '05 #1
4 3642
could ildg wrote:
I want to compare 2 directories,
and find If all of theire sub-folders and files and sub-files are identical.
If not the same, I want know which files or folders are not the same.
I know filecmp moudle has cmpfiles function and a class named dircmp,
they may help, but I wonder if there is a ready-to-use function in python libs?


That's a good start. Why doesn't dircmp work for you?
--
Michael Hoffman
Jul 19 '05 #2
I found dircmp compare only the direct dirs and files,
and it will not do anything to the sub-directories.

On 6/29/05, Michael Hoffman <ca*******@mh39 1.invalid> wrote:
could ildg wrote:
I want to compare 2 directories,
and find If all of theire sub-folders and files and sub-files are identical.
If not the same, I want know which files or folders are not the same.
I know filecmp moudle has cmpfiles function and a class named dircmp,
they may help, but I wonder if there is a ready-to-use function in python libs?


That's a good start. Why doesn't dircmp work for you?
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list

Jul 19 '05 #3
could ildg wrote:
I found dircmp compare only the direct dirs and files,
and it will not do anything to the sub-directories.


The documentation for dircmp.report_f ull_closure() disagrees with you.
--
Michael Hoffman
Jul 19 '05 #4
Thank you~
I get it.

On 6/30/05, Michael Hoffman <ca*******@mh39 1.invalid> wrote:
could ildg wrote:
I found dircmp compare only the direct dirs and files,
and it will not do anything to the sub-directories.


The documentation for dircmp.report_f ull_closure() disagrees with you.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list

Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
4525
by: Robin Siebler | last post by:
I have two directory trees that I want to compare and I'm trying to figure out what the best way of doing this would be. I am using walk to get a list of all of the files in each directory. I am using this code to compare the file lists: def compare_files(first_list, second_list, first_dir, second_dir): missing = in_first_only(first_list, second_list) for item in missing: index = first_list.index(item)
0
1241
by: Jeff Higgins | last post by:
Hi all Newbie to XPath. Can someone help with an XPath expression(s) that will accomplish the following using JAXP in J2SE-1.5. Thanks Jeff Higgins In a class I have two private org.w3c.dom Document fields; Directories,and FileList, that are populated as below;
1
1547
by: Heath | last post by:
I'm dealing with a C# application that monitors changes to the file system, and need to exclude irrelevent directories, temp directories for example. Is there any way to identify such directories, perhaps through DirectoryInfo or something similar that might give some attribute that temp, system, hidden, etc directories might be tagged with? I wanted to write this code to check and ignore such directories dynamically based on...
8
2407
by: Peter Larsen [] | last post by:
Hi, If i have a mapped drive and an UNC path - both pointing to the same directory on the server, how do i determine if they match (point to the same directory on the server) ?? Thank you. BR Peter
3
1902
by: could.net | last post by:
I want to compare 2 directories: dir1 and dir2. What I want to do is to get these informations: 1. does they have the same number of files and sub-directories? 2. does each file with the same name have the same size and date information? So, how can I do it in python? Thank you!
4
4221
by: rn5a | last post by:
I have a ListBox which should list all the files & directories that exist in a particular directory. The problem is I can get the ListBox to list either all the files or all the directories but not the 2 of them together. This is what I tried: Sub Page_Load(.....) Dim dInfo As DirectoryInfo dInfo = New DirectoryInfo(Server.MapPath(MyDir))
5
5573
by: stamatis32 | last post by:
Hello everybody, i want to make a prog to compare the contents of 2 dirs. You can compare easily 2 files, but how this happend with dirs. I am very confused, i dont know where to start from, can anyone help? I search on many books but i haven't found anything similar
1
1632
by: Richard | last post by:
I'm writing code to compare two directories side-by-side, like FolderMatch or FolderSync. I've used ListBoxes in VB6, so have the idea about concatenating strings for list items, but have no experience with ListView. Which control do you suggest I use?
6
17009
by: =?Utf-8?B?WW9naSBXYXRjaGVy?= | last post by:
Hello, I am using Visual Studio-2003. I created a project to build my library. Since I am using third party libraries as well, I have specified those additional library dependencies in project as "Additional Dependencies" under Linker-Input options. Since those libraries are also in different directory, I specified that library path in project as "Additional Library Directories" under Linker-General options. This is where I see some...
0
8413
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8324
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8740
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8513
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8617
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7352
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.