Current location: Hot Scripts Forums » General Community » Script Requests » Need command/script to find out if two files are exactly the same


Need command/script to find out if two files are exactly the same

Reply
  #1 (permalink)  
Old 02-13-09, 03:42 PM
Jennic Jennic is offline
New Member
 
Join Date: Feb 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Need command/script to find out if two files are exactly the same

Hi all:

1. I am looking for a command, commands or a script, that will take two file names or file paths, compare their contents and report if they are the same. Files are text files and contents are to be compared text-wise.

2. I need to extend this further to compare two directories as follows.
- Do they have the same files ?
- Do the corresponding files have exactly the same text ?

3. And, to make it even more challengeing, I need to extend the above to two directories which contain several levels of subdirectories and files.

Needs to work on Win 2K and Vista.

Anyone up to the challenge ? If you can show me a way to a solution, that will be great.

Have a good day.

Jenni
Reply With Quote
  #2 (permalink)  
Old 02-14-09, 01:11 PM
randi-r-11 randi-r-11 is offline
New Member
 
Join Date: Feb 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Hi Jenni:

The following commands in biterscripting ( .com for free download) will compare two files.

cat "file1.txt" > $content1
cat "file2.txt" > $content2

if ($content <> $content)
echo DIFFERENT
endif

file1.txt and file2.txt are examples. I started a blog to describe how to develop comprehensive scripting solutions. I am creating a complete script that will meet all your requirements 1, 2 and 3. Feel free to periodically check that blog at scriptingsolutions at blogspot.com .

Randi
Reply With Quote
  #3 (permalink)  
Old 02-15-09, 09:11 AM
randi-r-11 randi-r-11 is offline
New Member
 
Join Date: Feb 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
You need to add the following line before the above script.

var str content1, content2

Randi
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Check uploaded files size zoliky PHP 5 09-27-06 01:52 PM
How to differenciate Newly created files from old files in a directory itssami PHP 1 08-14-06 09:41 AM
cant find files in php banli PHP 2 03-07-04 04:53 PM
netadmin project - delete files georgeminton Visual Basic 0 03-03-04 04:03 PM
How to <!--include .htm files in .php files cstallins PHP 4 10-27-03 05:35 AM


All times are GMT -5. The time now is 09:23 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.