Hi everyone,
I’m sure I’ve seen this somewhere, but can’t find it in the Wiki,
google, etc. Does anyone know of a script or something to move
attachments out of the DB and onto local disk?
Thanks,
js.
Jean-Sebastien Morisset, Sr. UNIX Administrator jsmoriss@mvlan.net
Alas, no. When I last I asked I was told it was a design feature. But it
does seem mighty useful,
as it would allow for OCR and indexing of attachments. I’d planned on
attempting this once I got the more important parts of our setup functional.
P.S. Grr reply-to one
P.P.S s/disk/fs/
Cambridge Energy Alliance: Save money & the planet
Alas, no. When I last I asked I was told it was a design feature. But it
does seem mighty useful,
as it would allow for OCR and indexing of attachments. I’d planned on
attempting this once I got the more important parts of our setup functional.
I’m using the following perl script to get a pgp-encrypted attachment
from a ticket to the local disk and decrypt it. If you want to do
OCR, then you probably want other mime-types, but this should give
you some ideas.
#!/usr/bin/perl -w
Get encrypted file from Ticket and decrypt it
my $t = shift;
die “Usage: $0 ticketnum” unless ($t =~ /^\d+$/);
my $att = rt show ticket/$t/attachments
;
foreach (split(/\n/,$att)) {
621: parsed_logs.zip.asc (application/pgp-encrypted / 358.4k),
print “Got $_\n”;
if (/\s(\d+):\s([\w.]+)\s\(application\/pgp-encrypted/) {
my $fn = $2;
my $a = $1;
if ( -e $fn ) {
print STDERR "$fn exists, skipping\n";
} else {
system("rt show ticket/$t/attachments/$a/content > $fn");
system("gpg $fn");
}
}
}
/ol
-=- Otmar Lendl – ol@bofh.priv.at -=-