Operating System - HP-UX
1753792 Members
5038 Online
108799 Solutions
New Discussion юеВ

Re: Compare two file system

 
Pranav Pachchigar
Occasional Advisor

Compare two file system

HI

I want to compare two file system and identify the file incomplete transfered by size on destination directory. then remove those incomplete transferd files.

Regards

Pranav Pachchigar
7 REPLIES 7
R.K. #
Honored Contributor

Re: Compare two file system

Hi Pranav,

Please make yur issue a bit more clear.

> I want to compare two file system

What I understand is, you have copied the file sys to another place and now want to compare (by size) whether every file is copied properly or not?

If this is the case, I have one way you can try:

# du -kx /abc_source/* > file1
# du -kx /abc_dest/* > file2
# cmp file1 file2

file1 and file2 contain size of every file in the file system and so they can be very long depending upon the file system size.

Well, there may better ways also. Keep searching for them if this does not serve you.

Regds,
R.K.
Don't fix what ain't broke
James R. Ferguson
Acclaimed Contributor

Re: Compare two file system

Hi:

Using size as a criteria to determine a successful transfer is potentially misleading. How you measure the size matters too.

If you are FTP'ing text files between a UNIX platform and a Windows one (for example), a carriage-return will be added to the newline line delimiters.

If you use 'cp' (for example) to copy a sparse file, then the file is "inflated". Utilities like 'pax' can retain the sparseness.

Directories are often larger on the source side of a copy than on the destination side. This is because once blocks are allocated to a directory's space they are not removed (but rather are left free) pending reuse of the space.

You might want to consider using 'diff' to compare files and directories along with a checksum calculation like 'cksum' or 'md5sum', for example if you want to be rigouous.

Regards!

...JRF...
RUET
Regular Advisor

Re: Compare two file system

You can use also rsync whish can be used to synchronized two directories
rsync can be used to test what is different with the dry run mode:
rsync -v -a -n -H sourcedir targetdir
sourcedir or targetdir can be nfs mounted
Note that rsync can also be used in a clients erver mode ..

I always use now rsync to do sync beetween two folders, even very large folder >100GB, it works well and it has big performance

patrick
Jamie A Dennis
Frequent Advisor

Re: Compare two file system

I would use dircmp if I want to check the contents of one directory against another. It will compare the directories and provide the differences for you.
"If hindsight is 20/20, why don't more people use their rearview mirrors?" - James (Jamie) A. Dennis, 1998
Pranav Pachchigar
Occasional Advisor

Re: Compare two file system

Dear

Let me clear.
i have HP unix 11.23, doing ftp from one sever to other unix server. My problem is that during ftp syncronizing due to network problem some files are not transfered completely,

e.g my source dir has file with 50mb but on destination it is transfered to 20mb (incompletely) transfered.

Now i want to identifiy those file with size mismatch at destination directory and remove those files so my ftp software will retransfer files from source to destination.

i tried rsync but not running in HP Unix
pl suggest what to


Thanks

pranav pachchigar

RUET
Regular Advisor

Re: Compare two file system

rsync is running on HP ux
you can download it from HP Softawre depot
It's a free software

Why not restarting the ftp, for 50MB it will take very low times to achieve ?
Dennis Handly
Acclaimed Contributor

Re: Compare two file system

>i want to identify those file with size mismatch at destination directory and remove those files so my ftp software will retransfer files from source to destination.

You could do a find on each and then use ll to get the lengths:
find . -type f -exec ll {} + | awk '{print $9, $5}' | sort > system_X.sort

Then use comm:
comm -13 system_src.sort system_des.sort

This will give a list of files that are different sizes OR aren't on the source machine.