I'm using RAR 3.80 (command-line) on CentOS 5.5.

I have a .rar file called example.rar; if I use the following command then I can clearly see that it displays an archive comment and a list of filenames:

rar l example.rar

 Name             Size   Packed Ratio  Date   Time     Attr      CRC   Meth Ver
-------------------------------------------------------------------------------
 google.txt         72       72 100% 13-07-09 17:42  .....A.   0D3BCA05 m0g 2.0
 0001.jpg   835119   835119 100% 10-09-07 11:31  .....A.   51139B05 m0g 2.0

I tried to delete google.txt from the archive using the following command:

rar d example.rar google.txt

However it didn't work and says:

Deleting from example.rar
No files to delete

Any ideas what's wrong?

I also want to overwrite the original archive comment with my own comment. I don't know how to do this, as RAR only has a command to add an archive comment, not delete or replace an existing comment. How can I do that?

link|improve this question
If you try "Add archive comment" when there is already a comment, does it overwrite it, barf, or fail silently? – Nick ODell May 8 '11 at 7:24
feedback

migrated from stackoverflow.com May 8 '11 at 8:14

This question came from our site for professional and enthusiast programmers.

2 Answers

up vote 0 down vote accepted

If you use the c command to add an archive comment, it will overwrite the archive comment that already exists, e.g.

rar c example.rar

As for deleting files from RAR archives, the syntax is definitely:

rar d example.rar google.txt

It may be possible that google.txt is in a subfolder inside the archive (although I would expect the subfolder itself to be listed in your included output). To see the exact filename including subfolder, use the verbose list command:

rar v example.rar

This will reveal the full path if google.txt is indeed inside a subfolder, e.g.

rar v example.rar

 Name             Size   Packed Ratio  Date   Time     Attr      CRC   Meth Ver
-------------------------------------------------------------------------------
 sub\google.txt         72       72 100% 13-07-09 17:42  .....A.   0D3BCA05 m0g 2.0
 0001.jpg   835119   835119 100% 10-09-07 11:31  .....A.   51139B05 m0g 2.0

You can then delete it by using the full path:

rar d example.rar sub\google.txt
link|improve this answer
feedback

google.txt is likely in a subdirectory.

So to delete, it would be:

 rar d example.rar subdir\google.txt

Instead of using the 'l' command to list, use the 'v' command to 'verbosely list'.

 rar v example.rar

The subdirectory name should appear.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.