- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Files compare
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2003 02:14 PM
02-19-2003 02:14 PM
Files compare
Subject: Please giveme a trick
I need to compare the files in two diferent directories on remote machines?
Which commands do that?
Before I use ls and find -not etc, but in HPux not work yet.
I need compare the files in the two directories and print the files that aren't in the second directory?
i.e.
Machine 1 Machine 2
DirectoryA DirectoryB
File1 File1
File2 File2
File3
I want to print la diference, like File3, because it isn't on machine 2..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2003 02:20 PM
02-19-2003 02:20 PM
Re: Files compare
# ls -1 | sort > machine1.file
on machine 1
# ls -1 | sort > machine2.file
on machine 2
Now copy the files to a directory on either machine 1 or machine 2 and then do
# diff machine1.file machine2.file
and see what your results are.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2003 02:26 PM
02-19-2003 02:26 PM
Re: Files compare
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2003 02:32 PM
02-19-2003 02:32 PM
Re: Files compare
'diff' will compare directories or files. Do:
# diff dir1 dir2
See the man pages for more information.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2003 02:36 PM
02-19-2003 02:36 PM
Re: Files compare
remsh hosts2 -n ls -d /dir2 | diff /Dir1 -
Some like this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2003 02:45 PM
02-19-2003 02:45 PM
Re: Files compare
I assume that you have remsh access to both the systems. If so, use this small script.
if [ $# -ne 2 ]
then
echo Usage $0: host1:dir1 host2:dir2
exit
fi
HOST1=$(echo $1|awk '{FS=":";print $1}')
DIR1=$(echo $1|awk '{FS=":";print $2}')
HOST2=$(echo $2|awk '{FS=":";print $1}')
DIR2=$(echo $2|awk '{FS=":";print $2}')
echo $HOST1 $HOST2 $DIR1 $DIR2
remsh $HOST1 -n "find $DIR1" |sort >> list1$$
remsh $HOST2 -n "find $DIR2" |sort >> list2$$
clear
echo Files on $HOST1 but not on $HOST2 > log
comm -23 list1$$ list2$$ >> log
rm list*
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2003 02:48 PM
02-19-2003 02:48 PM
Re: Files compare
BTW, above orthodox script produces the result in an output file called log in the current directory.
It prints everything including the subdirectories and the files in them. If you don't want it, change the "find" command inside remsh to "ls -ald" or whatever you want.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2003 04:57 AM
02-20-2003 04:57 AM
Re: Files compare
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2003 08:54 AM
02-24-2003 08:54 AM
Re: Files compare
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2003 05:13 PM
02-24-2003 05:13 PM
Re: Files compare
# diff file1 file2(file compare)
that's ok!!