Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

delete2folders does not delete folders that are excluded, because they are present on host1 #425

Open
Mer0me opened this issue Nov 14, 2023 · 4 comments
Assignees
Labels
Deletions Deletions issues Folders Folders issues

Comments

@Mer0me
Copy link

Mer0me commented Nov 14, 2023

I'm playing with all of the options of imapsync in order to sync only the necessary, running sync multiples times on the same mailboxes.

I've synced a first time some mailboxes forgetting exclusion of "Contacts" folder which is present on host1 but I don't want to be synced on host2.
Then I've added --delete2folders, --exclude "^Contacts" and --exclude "^Contacts/*" to my command line. But running this new command did not delete the Contacts folders on host2 as I expected.

Ok, it's not a bug : "Contacts" is a real folder on host1, and delete2folders only delete folders that are not present on host1.

But, is there another option to delete excluded folders that have been wrongly synced earlier ?

If not, maybe you should add an entry on the Emptying FAQ about that ?

@gilleslamiral gilleslamiral self-assigned this Nov 15, 2023
@gilleslamiral gilleslamiral added Folders Folders issues Deletions Deletions issues labels Nov 15, 2023
@gilleslamiral
Copy link
Member

If not, maybe you should add an entry on the Emptying FAQ about that ?

How about
https://imapsync.lamiral.info/FAQ.d/FAQ.Emptying.txt

=======================================================================
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

=======================================================================

@Mer0me
Copy link
Author

Mer0me commented Nov 17, 2023

I know imapsync can delete folders like this, but I think you should warn users that excluded folders are not deleted with delete2folders if they are present on host1.
During the preparation of the migration scenario, I've adjusted options when I've figured out that some folders should not be copied. Mailboxes used during this phase can still have unwanted folders at the end if we don't care.

@gilleslamiral
Copy link
Member

How about changing
https://imapsync.lamiral.info/README
with
,,,

 --delete2folders    : Delete folders in host2 that are not in host1.
                       Only the selected folders are considered, all folders by 
                       default but not all with --exclude --include --folder etc.
                       For safety, first try it like this, it is safe:
                       --delete2folders --dry --justfolders --nofoldersizes
                       and see what folders will be deleted.

@Mer0me
Copy link
Author

Mer0me commented Nov 20, 2023

Seems good for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deletions Deletions issues Folders Folders issues
Projects
None yet
Development

No branches or pull requests

2 participants