mirror of
https://github.com/imapsync/imapsync.git
synced 2025-06-10 14:44:32 +02:00
153 lines
No EOL
5.8 KiB
Text
153 lines
No EOL
5.8 KiB
Text
#!/bin/cat
|
|
$Id: FAQ.Emptying.txt,v 1.14 2022/06/08 11:08:39 gilles Exp gilles $
|
|
|
|
This documentation is also available online at
|
|
https://imapsync.lamiral.info/FAQ.d/
|
|
|
|
https://imapsync.lamiral.info/FAQ.d/FAQ.Emptying.txt
|
|
|
|
=======================================================================
|
|
Imapsync tips about deletions.
|
|
=======================================================================
|
|
|
|
Questions answered in this FAQ are:
|
|
|
|
Q. How to delete all emails of all folders of an account with imapsync?
|
|
|
|
Q. How to delete all folders of an account with imapsync?
|
|
|
|
Q. How to delete some folders of an account with imapsync?
|
|
|
|
Q. How to revert a sync that went to the wrong account?
|
|
|
|
Q. How to delete emails older than 90 days with imapsync?
|
|
|
|
Q. How to delete emails matching a certain criterium with imapsync?
|
|
|
|
Q. Is there a way to delete the destination folders when the source
|
|
folders are no longer there?
|
|
|
|
Now the questions again with their answers.
|
|
|
|
=======================================================================
|
|
Q. How to delete all emails of all folders of an account with imapsync?
|
|
|
|
R. Use the same account on both sides with option --delete1
|
|
--noexpungeaftereach
|
|
|
|
Option --noexpungeaftereach is just to speed up the deletions.
|
|
|
|
Example:
|
|
|
|
imapsync \
|
|
--host1 test.lamiral.info --user1 foo --password1 secret \
|
|
--host2 test.lamiral.info --user2 foo --password2 secret \
|
|
--delete1 --noexpungeaftereach
|
|
|
|
=======================================================================
|
|
Q. How to delete all folders of an account with imapsync?
|
|
|
|
R. Use the same account on both sides with the options
|
|
--delete1 --noexpungeaftereach --delete1emptyfolders
|
|
|
|
imapsync ... --delete1 --noexpungeaftereach --delete1emptyfolders
|
|
|
|
It won't delete the folder INBOX since INBOX is mandatory in imap.
|
|
|
|
|
|
=======================================================================
|
|
Q. How to delete some folders of an account with imapsync?
|
|
|
|
R. Use the same account on both sides with the options
|
|
--delete1 --noexpungeaftereach --delete1emptyfolders
|
|
like when deleting all folders BUT select only the folders
|
|
you want to delete by using options to select folders,
|
|
like --folder or --folderrec or --include or --exclude
|
|
|
|
Example, to delete the folder Blabla
|
|
|
|
imapsync ... --delete1 --noexpungeaftereach --delete1emptyfolders --folder Blabla
|
|
|
|
To delete the four folders Kalender Kontakte Aufgaben Notizen:
|
|
|
|
imapsync ... --include 'Kalender|Kontakte|Aufgaben|Notizen' \
|
|
--delete1 --noexpungeaftereach --delete1emptyfolders
|
|
|
|
I strongly recommend to use --dry first!
|
|
|
|
To get an overview of how to select folders, see
|
|
https://imapsync.lamiral.info/FAQ.d/FAQ.Folders_Selection.txt
|
|
|
|
=======================================================================
|
|
Q. How to revert a sync that went to the wrong account?
|
|
|
|
R. If all the wrong emails have some common characteristic that is not
|
|
shared by the good one, then you can search for them and delete them
|
|
using the same account as source and destination. For example, if all
|
|
the messages have the same email destination address as
|
|
"john_smith@example.com", then you can remove them with the following
|
|
command:
|
|
|
|
imapsync ... --search "TO john_smith@example.com" --delete1
|
|
|
|
Be very careful with deletions! Since this section deals with something
|
|
that was made wrong, you're in good place to make a new one!
|
|
|
|
There is many possibilities to select messages with different criterium.
|
|
See some of them by reading the document
|
|
https://imapsync.lamiral.info/FAQ.d/FAQ.Messages_Selection.txt
|
|
|
|
If the wrongly emails messages synced have no special common
|
|
characteristic then take an handkerchief and cry.
|
|
|
|
=======================================================================
|
|
Q. How to delete emails older than 90 days with imapsync?
|
|
|
|
R. Use the same account on both sides with option --delete1
|
|
--noexpungeaftereach --minage 90
|
|
|
|
Example:
|
|
|
|
imapsync \
|
|
--host1 test.lamiral.info --user1 foo --password1 secret \
|
|
--host2 test.lamiral.info --user2 foo --password2 secret \
|
|
--delete1 --noexpungeaftereach --minage 90
|
|
|
|
=======================================================================
|
|
Q. How to delete emails matching a certain criterium with imapsync?
|
|
|
|
R. Use the --search option to select the messages you want to delete
|
|
and then use the same account on both sides with the suplementary
|
|
options --delete1 --noexpungeaftereach
|
|
To select the messages read the document FAQ.Messages_Selection.txt
|
|
at https://imapsync.lamiral.info/FAQ.d/FAQ.Messages_Selection.txt
|
|
|
|
|
|
Example:
|
|
|
|
imapsync \
|
|
--host1 test.lamiral.info --user1 foo --password1 secret \
|
|
--host2 test.lamiral.info --user2 foo --password2 secret \
|
|
--delete1 --noexpungeaftereach --search "SENTBEFORE 31-Dec-2010"
|
|
|
|
======================================================================
|
|
Q. Is there a way to delete the destination folders when the source
|
|
folders are no longer there?
|
|
|
|
R. Yes, use --delete2folders
|
|
|
|
--delete2folders : Delete folders in host2 that are not in host1.
|
|
For safety, first try it like this, it is safe:
|
|
--delete2folders --dry --justfolders --nofoldersizes
|
|
and see what folders will be deleted.
|
|
|
|
--delete2foldersonly reg : Delete only folders matching the regex reg.
|
|
Example: --delete2foldersonly "/^Junk$|^INBOX.Junk$/"
|
|
This option activates --delete2folders
|
|
|
|
--delete2foldersbutnot reg : Do not delete folders matching the regex rex.
|
|
Example: --delete2foldersbutnot "/Tasks$|Contacts$|Foo$/"
|
|
This option activates --delete2folders
|
|
|
|
=======================================================================
|
|
======================================================================= |