[X4U] Compare folders

John Baltutis baltwo at san.rr.com
Thu Mar 9 10:41:47 PST 2006


On 03/09/06, Paul Moortgat <paul.moortgat at pandora.be> wrote:
>
> Is there an Applescript file which allows me to compare the content 
> of 2 folders and copy items from folder 1 to folder 2 if the latter
> isn't like folder 1?

>From yesterday's MacFixIt, but not tested here:

MacFixIt reader Marlinespike offers an AppleScript will display detail about
every file contained in a given folder. This script can be run on multiple
folders, then the user can compare results, determining if an exact copy was
made.

Open Script Editor (located in Applications/AppleScript), and past the
followingtext, then click the "Compile" then "Run" buttons. Select the folder
about which you would like information. A series of stats which will be
generated, and automatically put in your clipboard. You can then paste this
text into a document, and run the script on another folder, comparingthe
results.

tell application "Finder"
set my_folder to (choose folder)
set item_all to count items of entire contents of my_folder
set doc_all to count document files of entire contents of my_folder
set alias_all to count alias files of entire contents of my_folder
set folder_all to count folders of entire contents of my_folder
set container_all to count containers of entire contents of my_folder
set disk_all to count disks of entire contents of my_folder
set application_file_all to count application files of entire contents of
my_folder
set internet_location_file_all to count internet location files of entire
contents of my_folder
set clipping_all to count clippings of entire contents of my_folder
set package_all to count packages of entire contents of my_folder
set the clipboard to the "The folder " & my_folder & " contains " & (item_all
as string) & " items of the types, "& (doc_all as string) & " documents, " &
(folder_allas string) & " folders, " & (alias_all as string) &" alias files, "
& (container_all as string) & " containers, " & (disk_all as string) & " disks,
" & (application_file_all as string) & " application files, " & (clipping_all
as string) & " clippings, " & (package_all as string) & " packages, and " &
(internet_location_file_all as string) & " internet location files."
display dialog "The folder " & my_folder & " contains "& (item_all as string) &
" items of the types, " & (doc_all as string) & " documents, " & (folder_all as
string) & " folders, " & (alias_all as string) & " alias files, " &
(container_all as string) & " containers, " &(disk_all as string) & " disks, "
& (application_file_allas string) & " application files, " & (clipping_all as
string) & " clippings, " & (package_all as string) & " packages, and " &
(internet_location_file_all as string) & " iinternet location files." & return
& return &"You can copy from the clipboard now. :D" buttons {"OK"} default
button 1
end tell


More information about the X4U mailing list