hi,
i’ve been working on this script for a time now. it has to compare text files in one folder, with text files in another folder.
before this, i was trying to compare just 2 text files, but the size of the files was of 30mb each, and the system returned “out of memory”.
so i now i have 30 files for each larga file. and i want to compare them.
each file has the same structure:
file:
MD5 (/Volumes/folder/subfolder/file1.jpg) = 194577a7e20bdcc7afbb718f502c134c
MD5 (/Volumes/folder/subfolder/file2.jpg) = 8df4d01824e6538c2bd06bc252180522
MD5 (/Volumes/folder/subfolder/file3.jpg) = cfa5eaff431641a376de8d7d7191a803
MD5 (/Volumes/folder/subfolder/file4.jpg) = a1b586895c87bf91bc463a73a0f6c575
MD5 (/Volumes/folder/subfolder/file5.jpg) = 81a9792bc22ae12cf00451e6f7b65fab
and this is my script (with the Bruce’s ProgressBar added)
set folder1 to (choose folder with prompt "Select folder of source databases") as string
set folder2 to (choose folder with prompt "Select folder of target databases") as string
tell application "System Events"
set files1 to every file of folder folder1
set files2 to every file of folder folder2
end tell
set Progress to load script (path to resource "Progress.scpt")
tell Progress
initialize()
setTitle to "Compare Parsed Databases"
changeIcon to POSIX path of (path to resource "m.jpg")
barberPole(false)
setMax to number of items in files1
end tell
set c to 1
try
repeat with i from 1 to (count items of files1)
set log1 to (item i of files1 as alias)
set log1info to info for log1
set log2 to (item i of files2 as alias)
set log2info to info for log2
if (visible of log1info is true and alias of log1info is false) and (visible of log2info is true and alias of log2info is false) then
set log_1 to read file (log1 as string) as Unicode text
set log_2 to read file (log2 as string) as Unicode text
set log_1_items to paragraphs of log_1
set AppleScript's text item delimiters to {" = "}
tell Progress
setStatusTop to ("Comparing " & (name of log1info) & " with " & (name of log2info))
setStatusBottom to ("Files left: " & ((number of items in files1) - c))
end tell
repeat with j from 1 to ((count of log_1_items) - 1) by 1
if log_2 does not contain item 2 of (text items of (item j of log_1_items)) then
do shell script "echo " & (quoted form of (item j of log_1_items)) & " >> ~/Desktop/NoMatch.txt"
end if
end repeat
end if
tell Progress to increase by 1
set c to (c + 1)
end repeat
tell Progress to quit
on error err
display dialog err
tell Progress to quit
end try
this should compare the first item of one folder, with the first of the second; then the second from one to the second of the other, and so on. and when it finds that a file from one IS NOT in the other, it should print it in a .txt file.
but i get this error:
Could not run this script because of an Apple Event error.
-1700
it happens in the middle of the script, so i assume that something with the shell script is messing things up…
i can’t find what does -1700 mean, and i don’t see anything wrong ( at least with my newbie eyes )
if anyone could give me a hint, i would much appreciate it.
thanks guys!!!
Marto.