rar2fs icon indicating copy to clipboard operation
rar2fs copied to clipboard

[FEATURE REQUEST] - Ability to delete inside rar

Open karibertils opened this issue 5 years ago • 11 comments

If possible, the ability to rm -rf folder to delete the underlying rar files would be very useful.

This might be difficult to implement if there are multiple files inside the rar archive. But at least in my case, if ANY files from inside the rar archive attempt delete, then it's acceptable to delete all the rar files.

This would need to be behind flag since that would be unexpected behaviour for those not aware of how it works.

karibertils avatar Mar 11 '21 21:03 karibertils

And just deleting from the source folder is not enough?

hasse69 avatar Mar 12 '21 07:03 hasse69

When using things like sonarr which can scan and upgrade media files to higher quality. It causes problem since sonarr cannot delete the old files. You can't scan the source folder since then it can't see the media files.

karibertils avatar Mar 12 '21 16:03 karibertils

Got it. But how do you foresee this? I guess it is not the parent folder deletion you wish to trigger on but deletion of actual media files inside archives? So that if the archive holds only that single file it should delete the archive instead? Please describe the use case in detail or it will be hard to estimate amount of work needed.

hasse69 avatar Mar 12 '21 19:03 hasse69

Yes exactly.

If I have multiple folders Video.XX which each contains a rar archive which has inside a single .mkv file. Through rar2fs all applications will see each of these folders as having a single .mkv file.

Sonarr can scan the folders and put upgraded .mkv into each folder where possible. Then afterwards when it tries to delete the previous .mkv it gets cannot remove 'XXXXX.mkv': operation not permitted. The idea was that at that time, instead of error, the system would accept removing the .mkv file and would also remove the underlying .rar archives.

But as I am typing this. I am thinking it would be much better actually, if rar2fs could at the time of delete, mkdir Video.XX/.deletedByRar2fs and move the underlying rar archive files to there. The mounted file system would hide everything that is in .deletedByRar2fs folders. So from the applications point of view the .mkv file was simply removed successfully and is now gone.

Then it would be impossible to have any kind of accidental data loss. But you could also get these kind of tools to work perfectly.

karibertils avatar Mar 12 '21 20:03 karibertils

Doable I guess. But always moving deleted files to a trash-style folder might not be what you want either. But to allow deletion of an entire archive simply because a single file in it is "deleted", well I need to think about that one. From what I understand it would not be needed to cover your specific use-case anyway and it would appear more consistent not to allow it.

hasse69 avatar Mar 12 '21 21:03 hasse69

Yes you understand correctly. For my use case, moving the archives for deleted files using trash style folder is just perfect. After thinking about it more, I see no reason for deleting the archives instead of just moving them. Looking forward to see if you can come up with a solution.

karibertils avatar Mar 12 '21 22:03 karibertils

Unfortunately I cannot give you an ETA on this. I am rather busy right now and thus not able to look into it at the moment.

hasse69 avatar Mar 15 '21 16:03 hasse69

I was thinking, would it matter if actual archive is left as is and that only files get hidden from user?

hasse69 avatar May 03 '21 11:05 hasse69

In my case it does not matter as long as there is some way to find which archive files were deleted. To be able to have some script "real" delete them periodically.

karibertils avatar May 03 '21 13:05 karibertils

So a "fake" file residing under the rar2fs mount point as e.g. .~~some-archive.rar would be good enough to track what files that may be safely removed if it no longer provides any content?

hasse69 avatar May 03 '21 19:05 hasse69

Sure, that's fine

karibertils avatar May 03 '21 19:05 karibertils