• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Subfolder archiving errors
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Subfolder archiving errors


  • Subject: Subfolder archiving errors
  • From: "Mike Wendelken" <email@hidden>
  • Date: Mon, 15 Mar 2004 20:35:15 -0600

I have this script to archive subfolders. Put I seem to missing a line or
need to fix some code. I want to make this script so it is unlimited when
checking for subfolders. The way it is now I get a Apple event error when
working in a folder
.
set max_size to (640 * (1024 ^ 2)) --640 MBs
set subfolder_prefix to "subfolder "

tell application "Finder"
activate
set the_folder to (choose folder) as alias
set {i, j, the_contents} to {0, 1, (items of the_folder)}
set new_folder to make new folder at the_folder with properties
{name:(subfolder_prefix & (j as string))}
repeat with This_Item in the_contents
if folder of This_Item = true then
try
set the_size to physical size of This_Item
on error
set the_size to size of This_Item
end try
else
set the_size to size of This_Item
end if
if (i + the_size) < max_size then
set i to (i + the_size)
move This_Item to new_folder
else
set {i, j} to {the_size, (j + 1)}
set new_folder to make new folder at the_folder with properties
{name:(subfolder_prefix & (j as string))}
move This_Item to new_folder
end if
end repeat
beep
display dialog (((count of the_contents) as string) & " items split into
" & (j as string) & " subfolders.") buttons {"OK"} default button 1 with
icon 1 giving up after 10
end tell

Michael Wendelken/TSR
Nec Inc.
345 7th Ave Suite 1101
New York,NY 10001
Phone: 646-733-9166 ext. 4009
Fax: 646-733-9178
email@hidden
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.


  • Prev by Date: [ANN] iMagine Photo
  • Next by Date: Re: How to detect a file has resource fork, or not?
  • Previous by thread: [ANN] iMagine Photo
  • Next by thread: Drive mapping question
  • Index(es):
    • Date
    • Thread