well this is as far as i went, the thing is that it does nothing… and there IS a duplicate in the folder i choose.
on run
try
tell application "Finder" to set inputFolder to files of entire contents of (choose folder) as alias list
--this will store the md5 signature of every file in 'signature'
set signature to {}
repeat with inputFile in inputFolder
set signature's end to last word of (do shell script "md5 " & quoted form of POSIX path of inputFile)
end repeat
display dialog signature as string
set dupFile to {}
repeat with x from 1 to number of items in signature
set itemSignature to item x of signature
set inputItem to item x of inputFolder
repeat with k from (x + 1) to count signature
if (item k of signature = itemSignature) then
set dupFile's end to item k of inputFolder
set N1 to name of (info for inputItem)
set N2 to name of (info for item 1 of dupFile)
my writeDuplicates(N1, N2)
end if
end repeat
set x to (x + 1)
end repeat
on error the error_message number the error_number
set the error_text to the error_number & the error_message
my write_error_log(the error_text)
end try
end run
on writeDuplicates(file1, file2)
set the dupLog to "Marto:Users:Marto:Desktop:duplicates log.txt"
try
open for access file the dupLog with write permission
write (file1 & " = " & file2 & return & return) to file the dupLog starting at eof
close access file the dupLog
on error
try
close access file the dupLog
end try
end try
end writeDuplicates
on write_error_log(this_error)
set the error_log to "Marto:Users:Marto:Desktop:Error Log.txt"
set the date_stamp to ((the current date) as string)
try
open for access file the error_log with write permission
write (tab & date_stamp & return & this_error & return & return) to file the error_log starting at eof
close access file the error_log
on error
try
close access file the error_log
end try
end try
end write_error_log
i think the problem is with ‘signature’, because when i diasplay a dialog as string of it, it returns something like:
fh023986h234j206978c2n4589cnv2458967n45698cf7n249687nv222689j9c874598nv4598n267b4672bnv04567bc9824756bc29348756bc2987456bc24893576fh2984756cfh290873456h390f876h340c6237047c57856b29c8b62304mx5235zsk2340jf623405783406
since there is only one string, i think there is something wrong… i really don’t know.
and another thing, i tried your script above, the first of all, setting it to ‘choose folder’, and it returns an error:
" Can’t make every file of alias (alias “Marto:Users:Marto:Desktop:pics:”) of application “Finder” into type «class alst». "
then, i changed the ‘choose folder’ to a fixed path of a folder with the pictures and one duplicated, and it returns another error:
" Can’t get item 1 of {}. "
in reply:
yes i have lots of subfolders.
i don’t know if you are familiar with the phpwebgallery thing, but thats was this is all about. there are some categories that have 50 files, others ( hte majority ) have from 500 to 1000 files, and a few have over 1000 to 6000.
this is the typical structure, it will take me forever to write the whole thing as i have it.
|-- galleries
| |-- category-1
| | |-- category-1.1
| | | |-- category-1.1.1
| | | | |-- category-1.1.1.1
| | | | | |-- pwg_high
| | | | | | ±- wedding.jpg
| | | | | |-- thumbnail
| | | | | | ±- TN-wedding.jpg
| | | | | ±- wedding.jpg
| | | | ±- category-1.1.1.2
| | | ±- category-1.1.2
| | |-- category-1.2
| | | |-- pookie.jpg
| | | | |-- pwg_high
| | | | | ±- pookie.jpg
| | | ±- thumbnail
| | | ±- TN-pookie.jpg
| | ±- category-1.3
in the category folder, are store the preview pics, a mid size file.
in the pwg_high, are stored the high resolution files, from 1mb to 25mb files.
in the thumbnail folder, are the… well, thumbnails.
the final step for the script is to tell it somehow to ignore files in folders named ‘thumbnail’ and ‘pwg_high’, because if it doesn’t, the amount of files is 150.000…
thank you.
Marto.
PS: i edited my script to try and make it check every file with every file and not to repeat the comparision… i know it looks like C++, but thats all i’ve ever learned…