Script to delete orphaned attachments?

2007-11-27 Thread Bill Courington
Is there such a thing? I've got about a zillion files in the Attachments
folder and I'm pretty sure (not positive) that many of them belong to
trashed messages. 

  Bill




Re: Script to delete orphaned attachments?

2007-11-27 Thread Justin Beek
I have a script that will move the attachments in the messages to separate
folders based on the Message ID Number.

After you run the script on all your messages, any files leftover *should*
be safe to trash.

It's a pretty nice script for Spring Cleaning. For example, if you have 5
messages with 5 attachments each, you'll end up w/ 5 folders instead of 25
files.

Good Luck,
Justin


On 11/27/07 10:18 AM, Bill Courington [EMAIL PROTECTED] wrote:

 Is there such a thing? I've got about a zillion files in the Attachments
 folder and I'm pretty sure (not positive) that many of them belong to
 trashed messages.
 
   Bill
 
 
 
 







powermail-discuss Digest #2746 - 11/27/07

2007-11-27 Thread PowerMail discussions
powermail-discuss Digest #2746 - Tuesday, November 27, 2007

  Re: Threading
  by Michael J. Hußmann [EMAIL PROTECTED]
  Re: Threading
  by Hans Gomme [EMAIL PROTECTED]
  resetting Spell checker to Mac OS X
  by angel Kyodo williams | urbanPEACE [EMAIL PROTECTED]
  Script to delete orphaned attachments?
  by Bill Courington [EMAIL PROTECTED]
  Re: Script to delete orphaned attachments?
  by Justin Beek [EMAIL PROTECTED]
  Re: Script to delete orphaned attachments?
  by Ben Kennedy [EMAIL PROTECTED]


--

Subject: Re: Threading
From: Michael J. Hußmann [EMAIL PROTECTED]
Date: Mon, 26 Nov 2007 22:27:51 +0100

Hans Gomme ([EMAIL PROTECTED]) wrote:

 I'm not sure but I think normal the MUA's I know do the
 threading by using the message ID. Normal every thread have
 a starting message id and if you look for example the
 message ID here (Message-Id:
 [EMAIL PROTECTED]) will be during
 the thread allways the same (local part) only if a reply of
 a reply follows the host part change.

 But I'm not the real expert in this thing I only think to
 remember to read something bout the threading and how it
 normal works in MUA's.

The message ID will be different for each mail within a thread, but
there is an In-Reply-To field that contains the message ID of the
message replied to; this is used for threading. For example, copying
from the header of your message:

Message-ID: [EMAIL PROTECTED]
In-Reply-To: [EMAIL PROTECTED]

[EMAIL PROTECTED] is the ID of Barbara's message
that you replied to.

However, sometimes threading doesn't work, either because someone
participating in an exchange doesn't use reply or because the reply is
to a message within a digest (which has its own message ID that is not
connected to any thread). Or someone hits Reply, but edits the subject
as he really wants to start a new thread. In the first case, the thread
breaks up into two subthreads, and in the second case, mail clients
supporting threading will display the message within a thread it doesn't
belong to.

 The List-id field was only a smal problem for me. And for
 me it's not so necessary like the possibility to sort by
 thread.

But thankfully, filtering for List-id isn't a problem at all; you can do
it if you want. If the mail headers do contain a List-id field, that is:
of the 16 mailing lists I've subscribed to, only 6 use list-id.

- Michael


Michael J. Hußmann

E-mail: [EMAIL PROTECTED]
WWW (personal): http://michael-hussmann.de
WWW (professional): http://digicam-experts.de


--

Subject: Re: Threading
From: Hans Gomme [EMAIL PROTECTED]
Date: Tue, 27 Nov 2007 01:05:52 +0100

On Mon, 26 Nov 2007 22:27:51 +0100,
[EMAIL PROTECTED] wrote:

 The message ID will be different for each mail within a thread, but
 there is an In-Reply-To field that contains the message ID of the
 message replied to; this is used for threading. For example, copying
 from the header of your message:

 Message-ID: [EMAIL PROTECTED]
 In-Reply-To: [EMAIL PROTECTED]

 [EMAIL PROTECTED] is the ID of Barbara's message
 that you replied to.

I see.

 However, sometimes threading doesn't work, either because someone
 participating in an exchange doesn't use reply or because the reply is
 to a message within a digest (which has its own message ID that is not
 connected to any thread). Or someone hits Reply, but edits the subject
 as he really wants to start a new thread. In the first case, the thread
 breaks up into two subthreads, and in the second case, mail clients
 supporting threading will display the message within a thread it doesn't
 belong to.

Well that can happend allways that someone destroy the
thread.

 The List-id field was only a smal problem for me. And for
 me it's not so necessary like the possibility to sort by
 thread.

 But thankfully, filtering for List-id isn't a problem at all; you can do
 it if you want. If the mail headers do contain a List-id field, that is:
 of the 16 mailing lists I've subscribed to, only 6 use list-id.

Well at me (ok only subscribed to yahoo and mailman lists
(think yahoo also use mailman) there is a list-id.
I looked into Gyazmail (because was interested) and also
here the thread was displayed good. (without list-id).
So I asked myself how other MUA's will do it? They also
like I would say cook only with water.

But thank you for explaining it to me. Like always to learn
new things.

--

Subject: resetting Spell checker to Mac OS X
From: angel Kyodo williams | urbanPEACE [EMAIL PROTECTED]
Date: Mon, 26 Nov 2007 16:21:41 -0800



greetings all,

i'm not sure what has happened here:

i have long had spell check working on PM just fine. recently, i got
a window saying that my trial of Spell Catcher was expired (i don't
recall downloading a trial!) and then PM started to 

Re: Script to delete orphaned attachments?

2007-11-27 Thread Ben Kennedy
Justin,

This sounds very useful.  Can you share?

-ben

Justin Beek wrote at 10:33 AM (-0600) on 11/27/07:

I have a script that will move the attachments in the messages to separate
folders based on the Message ID Number.

After you run the script on all your messages, any files leftover *should*
be safe to trash.

It's a pretty nice script for Spring Cleaning. For example, if you have 5
messages with 5 attachments each, you'll end up w/ 5 folders instead of 25
files.

Good Luck,
Justin


On 11/27/07 10:18 AM, Bill Courington [EMAIL PROTECTED] wrote:

 Is there such a thing? I've got about a zillion files in the Attachments
 folder and I'm pretty sure (not positive) that many of them belong to
 trashed messages.
 
   Bill
 
 
 
 






-- 
Ben Kennedy (chief magician)
zygoat creative technical services
http://www.zygoat.ca





filing attachments (was Re: Script to delete orphaned attachments?)

2007-11-27 Thread angel Kyodo williams | urbanPEACE

I'm not certain if this feature has been requested, but it would
be really helpful for me to be able to file attachments in their
appropriate folders in my overall file structure rather than solely
have things in PM's attachment folder where i have to move them
(and potentially orphan them.)

Does anyone know of a script that does this for now?

angel



Quoting Ben Kennedy [EMAIL PROTECTED]:


Justin,

This sounds very useful.  Can you share?

-ben

Justin Beek wrote at 10:33 AM (-0600) on 11/27/07:


I have a script that will move the attachments in the messages to separate
folders based on the Message ID Number.

After you run the script on all your messages, any files leftover *should*
be safe to trash.

It's a pretty nice script for Spring Cleaning. For example, if you have 5
messages with 5 attachments each, you'll end up w/ 5 folders instead of 25
files.

Good Luck,
Justin


On 11/27/07 10:18 AM, Bill Courington [EMAIL PROTECTED] wrote:


Is there such a thing? I've got about a zillion files in the Attachments
folder and I'm pretty sure (not positive) that many of them belong to
trashed messages.

  Bill












--
Ben Kennedy (chief magician)
zygoat creative technical services
http://www.zygoat.ca








PM 5.5.3 | OS X 10.5.1 | Powerbook G4/1.5 | 2G RAM | 80GB HD




Re: Script to delete orphaned attachments?

2007-11-27 Thread Justin Beek
Here it is. It does have some issues:

On older versions of PowerMail, having it set as an outgoing rule might
crash PowerMail.

And if you set it as a rule for all incoming, all the attachments will go
into a folder named -1 (issue w/ Finder  Powermail).

I just run it every few weeks to *fix* the folders from the -1 to the
correct folder.

Please be careful and test it before implementing. :)

Justin Beek

START

global theFolder

tell application PowerMail
set attachFolder to attachment folder

set theMessages to current messages
repeat with msg in theMessages
set msgStatus to status of msg

set attachList to attachments of msg
if (count items of attachList)  0 then
set theID to the ID of msg
set msgAttachFolder to 
set msgAttachFolder to theID
set msgAttachFolder to msgAttachFolder

tell application Finder
if not (exists folder (attachFolder  msgAttachFolder as string)) then set
theFolder to (make new folder at attachFolder with properties
{name:(msgAttachFolder as string)})
else
set theFolder to folder (attachFolder  msgAttachFolder as string)
end if
end tell
repeat with attachIdx from (count items of attachList) to 1 by -1
set attachFile to file of (item attachIdx of attachList)
tell application Finder
set newAttachFile to (move attachFile to theFolder without replacing) as
alias
end tell
delete attachment attachIdx of msg
make new attachment at msg with properties {file:(newAttachFile as alias)}
end repeat
end if
end repeat
end tell

END

On 11/27/07 12:37 PM, Ben Kennedy [EMAIL PROTECTED] wrote:

 Justin,
 
 This sounds very useful.  Can you share?
 
 -ben
 
 Justin Beek wrote at 10:33 AM (-0600) on 11/27/07:
 
 I have a script that will move the attachments in the messages to separate
 folders based on the Message ID Number.
 
 After you run the script on all your messages, any files leftover *should*
 be safe to trash.
 
 It's a pretty nice script for Spring Cleaning. For example, if you have 5
 messages with 5 attachments each, you'll end up w/ 5 folders instead of 25
 files.
 
 Good Luck,
 Justin
 
 
 On 11/27/07 10:18 AM, Bill Courington [EMAIL PROTECTED] wrote:
 
 Is there such a thing? I've got about a zillion files in the Attachments
 folder and I'm pretty sure (not positive) that many of them belong to
 trashed messages.
 
   Bill
 
 
 
 
 
 
 
 
 







Re: filing attachments (was Re: Script to delete orphaned attachments?)

2007-11-27 Thread Justin Beek
I hate the renaming of attachments by PowerMail and I have petitioned for a
fix a few time. It's not a real issue with anyone else, I guess.

Justin


On 11/27/07 1:18 PM, angel Kyodo williams | urbanPEACE
[EMAIL PROTECTED] wrote:

 I'm not certain if this feature has been requested, but it would
 be really helpful for me to be able to file attachments in their
 appropriate folders in my overall file structure rather than solely
 have things in PM's attachment folder where i have to move them
 (and potentially orphan them.)
 
 Does anyone know of a script that does this for now?
 
 angel
 
 
 
 Quoting Ben Kennedy [EMAIL PROTECTED]:
 
 Justin,
 
 This sounds very useful.  Can you share?
 
 -ben
 
 Justin Beek wrote at 10:33 AM (-0600) on 11/27/07:
 
 I have a script that will move the attachments in the messages to separate
 folders based on the Message ID Number.
 
 After you run the script on all your messages, any files leftover *should*
 be safe to trash.
 
 It's a pretty nice script for Spring Cleaning. For example, if you have 5
 messages with 5 attachments each, you'll end up w/ 5 folders instead of 25
 files.
 
 Good Luck,
 Justin
 
 
 On 11/27/07 10:18 AM, Bill Courington [EMAIL PROTECTED] wrote:
 
 Is there such a thing? I've got about a zillion files in the Attachments
 folder and I'm pretty sure (not positive) that many of them belong to
 trashed messages.
 
   Bill
 
 
 
 
 
 
 
 
 
 
 --
 Ben Kennedy (chief magician)
 zygoat creative technical services
 http://www.zygoat.ca
 
 
 
 
 
 
 
 PM 5.5.3 | OS X 10.5.1 | Powerbook G4/1.5 | 2G RAM | 80GB HD
 
 
 
 







Re: Script to delete orphaned attachments?

2007-11-27 Thread Ben Kennedy
Great, thanks Justin!

I tested this on a few messages and for the most part it seems to work
great.  Here are a couple more caveats I noticed:

- if a message contains any deleted attachments, any other still-
existing attachments will not be touched.

- if an attachment has been already moved somewhere else on the
filesystem (out of the default PM attachments folder), it will be
nonetheless dutifully relocated back into the attachments folder.  This
is counter to what behaviour I would want.  Probably a simple check for
the attachment's current folder would alleviate this.

- it might be cool if the names of the created subfolders were appended
with e.g. the sender's e-mail address, and/or message date, to aid in
quick management/cleanup from the finder.

- if a future revision of PM would facilitate the proper behaviour when
used as an incoming filter, that would be right fantastic.

Unfortunately I am not adept enough with AS nor do I have the time right
at the moment to try and implement these fixes myself, but I thought I
would mention them in case anyone else is inclined.

Great starting point though; I can see myself eventually using this
regularly (particularly if it eventually works as an incoming filter)!

-ben


Justin Beek wrote at 1:55 PM (-0600) on 11/27/07:

Here it is. It does have some issues:

On older versions of PowerMail, having it set as an outgoing rule might
crash PowerMail.

And if you set it as a rule for all incoming, all the attachments will go
into a folder named -1 (issue w/ Finder  Powermail).

I just run it every few weeks to *fix* the folders from the -1 to the
correct folder.

Please be careful and test it before implementing. :)


-- 
Ben Kennedy (chief magician)
zygoat creative technical services
http://www.zygoat.ca





Re: Script to delete orphaned attachments?

2007-11-27 Thread Marlyse Comte
wanted to try this one - sounds very useful - but can't get it to
compile, it gets a hiccup on else set theFolder to folder... any hints
how to get it to compile? (I think I'm good on the line endings so far).

---marlyse


 former message(s) quotes: -


Here it is. It does have some issues:

On older versions of PowerMail, having it set as an outgoing rule might
crash PowerMail.

And if you set it as a rule for all incoming, all the attachments will go
into a folder named -1 (issue w/ Finder  Powermail).

I just run it every few weeks to *fix* the folders from the -1 to the
correct folder.

Please be careful and test it before implementing. :)

Justin Beek

START

global theFolder

tell application PowerMail
set attachFolder to attachment folder

set theMessages to current messages
repeat with msg in theMessages
set msgStatus to status of msg

set attachList to attachments of msg
if (count items of attachList)  0 then
set theID to the ID of msg
set msgAttachFolder to 
set msgAttachFolder to theID
set msgAttachFolder to msgAttachFolder

tell application Finder
if not (exists folder (attachFolder  msgAttachFolder as string)) then set
theFolder to (make new folder at attachFolder with properties
{name:(msgAttachFolder as string)})
else
set theFolder to folder (attachFolder  msgAttachFolder as string)
end if
end tell
repeat with attachIdx from (count items of attachList) to 1 by -1
set attachFile to file of (item attachIdx of attachList)
tell application Finder
set newAttachFile to (move attachFile to theFolder without replacing) as
alias
end tell
delete attachment attachIdx of msg
make new attachment at msg with properties {file:(newAttachFile as alias)}
end repeat
end if
end repeat
end tell

END

On 11/27/07 12:37 PM, Ben Kennedy [EMAIL PROTECTED] wrote:

 Justin,
 
 This sounds very useful.  Can you share?
 
 -ben
 
 Justin Beek wrote at 10:33 AM (-0600) on 11/27/07:
 
 I have a script that will move the attachments in the messages to separate
 folders based on the Message ID Number.
 
 After you run the script on all your messages, any files leftover *should*
 be safe to trash.
 
 It's a pretty nice script for Spring Cleaning. For example, if you have 5
 messages with 5 attachments each, you'll end up w/ 5 folders instead of 25
 files.
 
 Good Luck,
 Justin
 
 
 On 11/27/07 10:18 AM, Bill Courington [EMAIL PROTECTED] wrote:
 
 Is there such a thing? I've got about a zillion files in the Attachments
 folder and I'm pretty sure (not positive) that many of them belong to
 trashed messages.
 
   Bill
 
 
 
 
 
 
 
 
 










Re: Script to delete orphaned attachments?

2007-11-27 Thread Ben Kennedy
Marlyse Comte wrote at 7:28 PM (-0600) on 11/27/07:

wanted to try this one - sounds very useful - but can't get it to
compile, it gets a hiccup on else set theFolder to folder... any hints
how to get it to compile? (I think I'm good on the line endings so far).

Right, I found the same thing, and forgot to mention.

In the fifth paragraph, put a newline following then on this line:

if not (exists folder (attachFolder  msgAttachFolder as string)) then set

i.e. the following set theFolder to... should commence on its own line.

-ben

-- 
Ben Kennedy (chief magician)
zygoat creative technical services
http://www.zygoat.ca





Re: Script to delete orphaned attachments?

2007-11-27 Thread H.R. Riggs
Here's a challenge for those that are so inclined. I would find this
useful, and I think others might as well. Write a script to do the following:

1. Go through all messages. For any message with an attachment in the
Attachments folder

2. Put the attachment in a subfolder under Attachments that has the same
structure as the Mail folder/subfolder that the message is in.

In other words, if I have a message in Folder/Subfolder, then the
related attachment would go in

~/Mail/Powermail Files/Attachments/Folder/Subfolder

If the attachment has already been moved out of Attachments, the script
should do nothing.

Subsequent variation is:

3. A script that would do it for the selected messages only.


Ron

P.S. If anybody has such a thing, I would appreciate getting a copy.



Ben Kennedy wrote on 11/27/07:

Marlyse Comte wrote at 7:28 PM (-0600) on 11/27/07:

wanted to try this one - sounds very useful - but can't get it to
compile, it gets a hiccup on else set theFolder to folder... any hints
how to get it to compile? (I think I'm good on the line endings so far).

Right, I found the same thing, and forgot to mention.

In the fifth paragraph, put a newline following then on this line:

if not (exists folder (attachFolder  msgAttachFolder as string)) then set

i.e. the following set theFolder to... should commence on its own line.

-ben

-- 
Ben Kennedy (chief magician)
zygoat creative technical services
http://www.zygoat.ca