Comparing Folder Sizes - different results on different volume.

Hi,

I’m building a little helper which copies the contents of a local folder to another folder on our server - then compares their sizes to verify a successful copy.
The folders contain subfolders full of pretty pictures. (anywhere between 1 and 50 gb at a go)

it does it something like this…


with timeout of 0 seconds
		tell application "Finder"
			copy (every item of folder sourceFolder) to folder destinationFolder
		end tell
	end timeout

I then compares the folders like so…


set sourceSize to size of (info for sourceFolder)
set destSize to size of (info for destinationFolder)

if (sourceSize as string) ≠ (destSize as string) then
		--set failure message 
		display dialog "folder size comparison failed"
else
		--set success message
		display dialog "folder size comparison successful"
end if

The copy works fine - I can go through and count files etc and all is well.
HOWEVER - I never get a success message because the folder sizes are always very subtly different - by a few Kb

Whats going on?
Is there a better way to compare the contents of folders?

Any help appreciated - thanks!

B

Hi Benjamin,

a better way to compare files is to use a checksum comparison like

set theFile to choose file
set Checksum to (do shell script "md5 -q " & quoted form of POSIX path of theFile)

Note: md5 works only with files

Great!

I’ll use that when comparing files in future.

I’m most interested in comparing folders though.

Thanks

b