Extracting ALL of the attachments from a mailing list
Gerald Combs
gerald at ethereal.com
Fri Apr 29 08:49:41 CDT 2005
Kelsay, Brian - Kansas City, MO wrote:
> Wouldn't you want to check for dups. before you extract and mv to a dir?
> Or extract to dir., compare to final destination dir. And then mv file.
> You may want to compare filenames and dates to keep the newest or oldest
> file based on preference.
Yup. The current plan is to loop thusly:
for each list_archive_file:
run "formail -s mime_extraction_tool < list_archive_file"
for each extracted_file:
file_type = `file -z extracted_file`
if file_type == a_tar_file:
tar -xf extracted_file
else if file_type == a_gzipped_tar_file:
tar -xzf extracted_file
else if file_type == a_zip_file:
unzip extracted_file
for each raw_file `find extraction_dir -type f`:
if raw_file is a valid Ethereal capture file:
check for file name collision in target directory
check for a duplicate file in target directory:
move the file to the target directory
None of these steps should take too long to implement individually. I
was hoping someone would come back with "you can do that with AMaViS in
about 60 seconds" so I could be lazy and not have to cobble it together
myself.
More information about the Kclug
mailing list