0

Hi all

I just thought about backing up my home directory to a zip file so I used

zip backup-13-jul-09 .

Then I read about the argument

-u

so I found a file called readme.txt in my home directory opened it and added "Hello World" to the bottom line then performed the

zip -u backup-13-jul-09 .

command but it didn't update the readme.txt file to include "Hello World" on the last line.

Its probably something simple but can someone help me out please?

Many thanks

HLA91

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by sknake
0

I dont think your command worked:

sk@sk:~/zip$ zip backup .

zip error: Nothing to do! (backup.zip)

What I did to create the zip archive:

sk@sk:~/zip$ ls
readme.txt
sk@sk:~/zip$ tail -1 readme.txt
test123
sk@sk:~/zip$ zip -r backup ../zip
  adding: ../zip/ (stored 0%)
  adding: ../zip/readme.txt (stored 0%)

Now appending text an updating:

sk@sk:~/zip$ cp backup.zip .backup.zip
sk@sk:~/zip$ tail -2 readme.txt
test123
sk@sk:~/zip$ echo "hello, world" >> readme.txt
sk@sk:~/zip$ zip -u backup *
  adding: readme.txt (stored 0%)
sk@sk:~/zip$ diff .backup.zip backup.zip
Binary files .backup.zip and backup.zip differ
sk@sk:~/zip$ unzip backup.zip
Archive:  backup.zip
warning:  skipped "../" path component(s) in ../zip/
   creating: zip/
warning:  skipped "../" path component(s) in ../zip/readme.txt
 extracting: zip/readme.txt
replace readme.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: r
new name: readme2.txt
 extracting: readme2.txt
sk@sk:~/zip$ tail -2 readme2.txt
test123
hello, world

I think you probably had an error when you created the archive.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.