How to edit a file in a zip or rar archive?

15

I have a large archive with files that I need to edit, but I don't want to extract / zip every time. Is there a way to edit the files directly while in the archive? I opened them and when I save it prompts for a location.

Mankind1023

Posted 2010-09-19T16:58:15.673

Reputation: 609

Answers

12

7-Zip can do this: Open the archive, right-click on the file to edit and select "Edit". This will typically open the file in Notepad. When you exit Notepad, it will detect that the file has changed and load it back into the zip file, which may take a bit of time.

Steve Chambers

Posted 2010-09-19T16:58:15.673

Reputation: 618

1@JinSnow Thanks a lot. Similarly, when the editor is Word, you have to close every open Word window. – Noumenon – 2018-08-17T00:03:43.670

41: In 7-zip option, you can set np++ as editor. 2: If you use np++ to edit 7zip, be careful: saving isn't enough, you have to close np++ (7zip doesn't detect the change unless you close np++) – JinSnow – 2018-08-21T08:08:22.373

Can this work on binary files? – Wossname – 2018-10-18T13:50:02.087

doesn't work for guzzle's phar – beppe9000 – 2019-05-08T17:59:25.760

3

At least on Linux and Windows+Cygwin, you can use vim

It will let you browse inside the ZIP file, choose a text file and press Enter ↵ to edit it

golimar

Posted 2010-09-19T16:58:15.673

Reputation: 846

1

good info, if you get ***error*** (zip#Write) sorry, your system doesn't appear to have the zip pgm load ZIP https://stackoverflow.com/a/31988175/1747983

– Tilo – 2018-04-12T00:33:01.543

3

Simple answer is NO. There's no way to tell how big the resulting file will be after edit so it can't just be stored back in the same place in the zipfile. What you might be able to find is a program that allows you to do the extract/edit/rezip without you having to worry about the details yourself. It would help to specify your environment (OS etc).

hotei

Posted 2010-09-19T16:58:15.673

Reputation: 3 645

3

Use Total Commander. Navigate to the archive, hit Enter to enter the specific file you want to modify, hit Save after modify and close the editing program. Total Commander will ask you if you want to update the archive so you hit Yes.

m4niac

Posted 2010-09-19T16:58:15.673

Reputation: 31

doesn't work for me, it triggers explorer's unknown file type dialog – beppe9000 – 2019-05-08T18:00:01.487

1

Open the zip file with winrar, double click an embedded text file, it should open in an external editor. Change and close the text file. Winrar then asks if it should updated the archive with the changed file.

weberjn

Posted 2010-09-19T16:58:15.673

Reputation: 325

0

Use an editor that can look inside archives.

You don't say what platform you're using. If you use Ubuntu with its default interface, this is completely transparent: click on the archive, then click on the file inside the archive. More generally, open the archive in the Gnome archiver (File Roller) and edit the file in a Gnome application.

Emacs is available for every major desktop platform (and many minor ones) and transparently edits files inside archives (provided the relevant command-line archiving tool is installed).

Gilles 'SO- stop being evil'

Posted 2010-09-19T16:58:15.673

Reputation: 58 319

I'm using windows 7 and Winrar, for the moment I extracted / edited / re-archived the file which was a pain, but I will try one of these programs if the needs arise, which I'm sure it will, hopefully they work. – Mankind1023 – 2010-09-23T14:14:01.483

0

Use winrar or 7-zip to extract the file you want to edit. Then drag it back into the same directory in winrar/7-zip where you extracted it from in the archive.

Force Flow

Posted 2010-09-19T16:58:15.673

Reputation: 3 850