I have this script which archives nested folders. I try to run script but get a apple event error. Also it seems to create mutiple folders with the some name. Any input would help. thanks.
script VariationOne
set subfolder_prefix to "subfolder "
set max_size to (640 * (1024 ^ 2)) --640 MBs
set {i, j, tempList} to {0, 1, {}}
set the_folder to (choose folder) as alias
tell application "Finder"
get a reference to items of folder the_folder
{result as list, result's physical size as list}
set {itemList, sizeList} to result
set new_folder to make new folder at the_folder �
with properties {name:(subfolder_prefix & (j as string))}
repeat with theIdx from 1 to itemList's length
set the_size to sizeList's item theIdx
if i + the_size > max_size then
move tempList to new_folder
set {i, j, tempList} to {0, j + 1, {}}
set new_folder to make new folder at the_folder �
with properties {name:(subfolder_prefix & (j as string))}
end if
set end of tempList to itemList's item theIdx
set i to i + the_size
end repeat
move tempList to new_folder
end tell
display dialog ((itemList's length as string) & �
" items split into " & (j as string) & " subfolders.") �
buttons {"OK"} default button 1 with icon 1 giving up after 10
end script