Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So I have one RAR and I want to create another RAR from only the (let's say 10K) files inside that compressed archive without uncompressing it.

Hope this makes sense and thank you all in advance!

share|improve this question
up vote 3 down vote accepted

I'm going to have to disagree with the other answers posted so far. What you're looking to achieve is technically possible with certain caveats. Looking at the RAR archive format, if solid archiving and encryption are not used it is possible to create a new archive with a modified main archive header and only the required file records (file headers, data blocks, service headers etc.) copied over without the data blocks needing to be decompressed first.

The process should be similar to this one for ZIP files, suitably adjusted for the RAR format of course.

Also, I'd like to note that WinRAR already does this to some extent, i.e. if you delete files from a non-solid RAR archive it does not decompress the data in any way, though of course temp files may be used for safety.

So what are your options here?

  1. If you don't need the 50k files you can delete them directly from the source archive. If solid archiving wasn't used no decompression and recompression will be required.

  2. If you might need some of the files later you can copy the source archive and then follow option 1.

  3. Of course you can always extract and recompress only the required files as a new archive.

  4. Finally, like I said above if solid archiving wasn't used a new archive with only the required files can be created without decompression. However, since this is such an uncommon requirement I'm pretty sure no program already exists that can do this, so you'll have to write one yourself or wait till someone does so.

Note: Answer was posted after receiving confirmation from the WinRAR developer that the technical analysis was sound.

share|improve this answer
Even though @Sekhemty answer was right. Yours is way better (@Karan), because It's another way of seeing the problem and applying a better solution. It's a small trick that worked! Thanks Karan! – villancikos May 27 '13 at 15:59
@FernandoVilla: Glad I could help. :) – Karan May 27 '13 at 16:01

Someone may prove me wrong, but this should not be possible. Even though you see the list of files, the files themselves are compressed. An algorithm was used on all the files in the RAR to remove redundant data. The files you wish to create another archive from dont exist in a standard file format, therefore you would not be able to select them and create a new archive without uncompressing them first.

share|improve this answer
I see. Thanks for the answer @Keltari! – villancikos May 8 '13 at 20:45
Note that redundant data was removed across file boundaries only if solid archiving was employed. Obviously one can't simply assume that's the case here or always. – Karan May 14 '13 at 14:38
@Karan true, but based on the OPs comment, I can assume it is. :) – Keltari May 14 '13 at 15:13
TBH I see no comment from the OP to support that assumption. :) I may be wrong but from what I can see so far on this page I'm not even sure he knows about solid archiving and what exactly that option implies. I don't even see any mention of it here other than in my comments and answer. – Karan May 14 '13 at 15:21

I think that it's not possible; I've never seen an archiving software that let you do that.

Anyway, I think that there is no point in doing so: if you are trying to organize the files inside the archive, the best solution is to decompress it, put the files in an organized folder structure, and re-compress everything.
If you are trying, instead, to reduce the filesize, you must think that you are already working with compressed files, and that compressing them twice will give you small or no benefits under these respects.

share|improve this answer
Hi @Sekhemty more than that... the problem is that the folder contains around 60K small files from a remote server which makes rather difficult to do anything. So now that I have all the files in my side (compressed) I realized I don't need to use all of them just 10K, hope this makes sense. – villancikos May 8 '13 at 20:56
I can understand that working with that huge amount of small files should be a pain, but I don't think that an archiving tool can help you in the way you are looking for. I still think that your best bet is to extract them and re-compress just the ones you need. – Sekhemty May 8 '13 at 22:01
You were totally right. You helped me open my mind. Thanks a lot! – villancikos May 9 '13 at 15:22
You should be able to unpack the 10K files by themselves with RAR, but I have to agree that I have never attempted or even thought of doing so. However can you make a folder inside the archive then move the files to that folder? – Cole Busby May 13 '13 at 23:14
@ColeBusby: Note that the 10k files can be unpacked "by themselves" only if solid compression wasn't used. If solid compression was used there is a single compressed data stream for all files, so to access any file all the preceding data in the stream needs to be parsed first. – Karan May 14 '13 at 14:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .