473,396 Members | 1,655 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

bitwise comparison of files from two directories.

Please tell me how do you do bitwise comparison of files from two directories.
My current thinking is as:
Expand|Select|Wrap|Line Numbers
  1.     #!/usr/bin/perl -w
  2.  
  3.     $CMP="/usr/bin/cmp";
  4.  
  5.     $dir0=$ARGV[0];
  6.     $dir1=$ARGV[1];
  7.  
  8.     if(!$dir0 || !dir1){ print "Error: need both directory paths to compare";exit;}
  9.  
  10.     @files0=`find $dir0 -type f`;
  11.     $count=0;
  12.     foreach $file0 (@files0){
  13.     $file1=$file0;
  14.     $file1=~s/$dir0//;
  15.     $file1=$dir1.$file1;
  16.     chomp($file0);
  17.     chomp($file1);
  18.     $file0=~s/\$/\\\$/;
  19.     $file1=~s/\$/\\\$/;
  20.     system("$CMP $file0 $file1");
  21.     if($count>10){
  22.     print ".";
  23.     $count=0;
  24.     }else{
  25.     $count++;
  26.     }
  27.     }
Best regards,
Feb 14 '12 #1
0 1327

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Trinity | last post by:
Hi, I want to delete a particular file in all the sub-directories. I am using the SHFileOperation() API. But it is not deleting the files recursively. Any sample code is appreciated. TIA
8
by: Paul E Collins | last post by:
Suppose I have a few Keys objects: Keys k1 = Keys.V; // V Keys k2 = Keys.Control | Keys.V; // Ctrl+V Keys k3 = Keys.Shift | Keys.J; // Shift+J I need to determine which of these include the...
3
by: Anders Borum | last post by:
Hello! Consider the following enumeration used to combine several of the values. I am trying to figure out what the best solution is to check for the presence of a value using bitwise...
2
by: Mark Rae | last post by:
Hi, This isn't *specifically* an ASP.NET question, so I've also posted it in the ADO.NET group - however, it's not too far off-topic... Imagine a SQL Server 2005 database with a table with an...
3
by: simonharrison | last post by:
Hello everyone. Hopefully someone can point me in the right direction here. I'm wanting to write a script to open microsoft word and adobe pdf documents . Here is a little background: At the...
2
by: nospam | last post by:
I am writing this app in .net 2003 since all machines don't have 2.0 framework. I am trying to delete old profiles, but I am getting access denied or file in use errors. A lot of these files I am...
4
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...
2
by: Kevin D. Smith | last post by:
I would like to move files and directories to the Recycle Bin on Windows from Python. I have found some older articles describing how to do this, but they require additional packages to be...
3
by: Mike Dol | last post by:
Hi all, I want to create rows in a table which id's are 1 - 2 -4 - 8 - 16 - 32 etc. 0000 0 0001 1 0010 2 0011 3 0100 4 0101 5
2
by: ptn | last post by:
Hello, group. I can only read files and import modules that are in the same directory as the one my script is. Here is a test script (path.py): import os import uno # some module I wrote ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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...

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.