Edit comments .RAR file from python

Ok, I need to be able to edit comments on files in .rar files from python.

I can already view comments using UnRAR . However, I need to embed the metadata in the files in a way that is stored on several file systems (for example, there are no alternative data streams), so I can’t think of any other alternatives.

rarfile it seems that it can work, but it does not work fine under windows, despite the fact that it requires platform independence (or the .rar format has changed, but this is unlikely, given other utilities for the same period of time). He opens the archive perfectly, but he does not admit that there are comments.

Proactively respond to some of the inevitable comments -
No, I can’t convert archives (there are thousands of them).
There is no file system mode for storing metadata, since I need to support NTFS, XFS, and ext3.
Hidden files will be messy and you need to make sure that they are moved with the corresponding file, which I cannot do.

+4
source share
1 answer

I think you're out of luck. Unfortunately, the RAR format is closed source and not documented, and there is no Python module that does what you want to do.

The only open source tool I know that uncompress RAR files is Unarchiver. I think your best bet is to check their sources and write your own Python tool to modify file comments.

You can also try to ask this question on comp.compression boards, I had a similar question a few years ago with an unclear compression format, and people there could help me as soon as possible.

+1
source

Source: https://habr.com/ru/post/1315033/


All Articles