We have moved to a new Sailfish OS Forum. Please start new discussions there.
28

simple way to clean mail attachment subfolder mess [answered]

asked 2015-09-09 09:21:41 +0300

pawel gravatar image

updated 2015-09-15 09:15:45 +0300

currently i have hundrets of mostly empty folders in downloads/mail-attachments

Edit: i do not want to loose all attachments, so delete the mail_attachment root is not an option.

currently it seems i have to delete everything twice: i have to delete mail and its attachment from gallery. but then an empty folder remains. my expectation would be: deleting the mail also deletes the attachments. i have to move the file manually to gallery to make it permanent (which is currently not easy to do, need filebrowser for this)

edit retag flag offensive reopen delete

The question has been closed for the following reason "the question is answered, an answer was accepted" by pawel
close date 2015-12-31 15:12:08.152033

Comments

2

Agreed. Folders with attachments should be deleted automatically once the corresponding email is deleted.

(BTW, I fixed a typo in your thread title. Hope you don't mind.)

pichlo ( 2015-09-09 12:51:43 +0300 )edit
1

IMO best would be to simply prevent this mess by asking the user in a context menu what to do with the attachment when opening it from the mail app.

lakutalo ( 2015-12-31 10:14:11 +0300 )edit
1

Cannot argue with that. However the default when tapping an attachment should be downloading it to the temp folder and opening it, then deleting it immediately once the user has finished with it.

pichlo ( 2015-12-31 11:06:43 +0300 )edit

3 Answers

Sort by » oldest newest most voted
5

answered 2015-09-09 09:32:31 +0300

eson gravatar image

You could just delete the entire folder mail-attachments. It will be recreated the next time you download an attachment.

edit flag offensive delete publish link more

Comments

3

That may be the case but I agree with @pawel that this should be done automatically. Especially considering that tools for deleting folders (terminal, file browsers) are not installed by default and require steps that may lead to inadvertent damage in the hands of unexperienced users.

pichlo ( 2015-09-09 12:45:53 +0300 )edit
4

yes, i could also delete some subfolders. but some folders are not empty. they contain some pics i do not want to loose. i think when i delete a mail, the attachments should go too.

pawel ( 2015-09-09 16:16:41 +0300 )edit
1

When you delete an attachment, it gets re-downloaded again the next time you open that email. So deleting the folders is safe, only somewhat less convenient.

pichlo ( 2015-09-10 00:54:56 +0300 )edit

i delete mails you know ;-) so first i would need to backup the wanted attachments

pawel ( 2015-09-22 20:59:55 +0300 )edit

@pichlo, convert comment to answer please thanks, i did put your line to situations and run it once a day

pawel ( 2015-12-31 10:15:19 +0300 )edit
4

answered 2015-09-22 22:50:49 +0300

pichlo gravatar image

updated 2015-09-22 22:51:34 +0300

If it's just deleting the empty directories you want, you can do that simply by running this line from Terminal:

find /home/nemo/Downloads/mail_attachments -type d -size 0 -delete

You can of course replace the path with anything you want. The line will delete all empty directories below the specified path. Recursively.

edit flag offensive delete publish link more

Comments

Converted to answer as per request ;)

pichlo ( 2015-12-31 11:02:35 +0300 )edit
3

answered 2015-12-31 10:07:01 +0300

pawel gravatar image

open terminal navigate to Downloads\mail_attachments run: find . -empty -delete

edit flag offensive delete publish link more

Question tools

Follow
3 followers

Stats

Asked: 2015-09-09 09:21:41 +0300

Seen: 658 times

Last updated: Dec 31 '15