I'm having some issues with the MailMover class. I may be missing something but if so then I've not been able to see what...
The directory matching test on lines 65 and 66:
to_move_fnames = [name for name in all_message_fnames
if maildir in name]
Will not match directories in the config which are surrounded by quotes. As IMAP folders can have spaces in their names they wouldn't be able to match in this case.
Also, in cases where the destination is a sub-folder of the source, as is the case in my Maildir where all folders are children of INBOX, files in the destination folder will also pass this test, making the copy fail as it tries to copy the file over itself:
Traceback (most recent call last):
File "/usr/local/bin/afew", line 9, in <module>
load_entry_point('afew==0.0.0', 'console_scripts', 'afew')()
File "/usr/local/lib/python2.7/dist-packages/afew-0.0.0-py2.7.egg/afew/commands.py", line 203, in main
inner_main(options, database, query_string)
File "/usr/local/lib/python2.7/dist-packages/afew-0.0.0-py2.7.egg/afew/main.py", line 83, in main
mover.move(maildir, rules)
File "/usr/local/lib/python2.7/dist-packages/afew-0.0.0-py2.7.egg/afew/MailMover.py", line 76, in move
shutil.copy2(fname, destination)
File "/usr/lib/python2.7/shutil.py", line 130, in copy2
copyfile(src, dst)
File "/usr/lib/python2.7/shutil.py", line 69, in copyfile
raise Error("`%s` and `%s` are the same file" % (src, dst))
shutil.Error: `/home/tolan/mail/ops/INBOX/.Foo/cur/1410471077.4046_9.orbit,U=1452:2,S` and `/home/tolan/mail/ops/INBOX/.Foo/cur/1410471077.4046_9.orbit,U=1452:2,S` are the same file
Hi, Thanks for afew, it's great.
I'm having some issues with the MailMover class. I may be missing something but if so then I've not been able to see what...
The directory matching test on lines 65 and 66:
Will not match directories in the config which are surrounded by quotes. As IMAP folders can have spaces in their names they wouldn't be able to match in this case.
Also, in cases where the destination is a sub-folder of the source, as is the case in my Maildir where all folders are children of INBOX, files in the destination folder will also pass this test, making the copy fail as it tries to copy the file over itself: