Is it a good habit to rm zip file before packing folders?
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
0
down vote
favorite
I have a folder with some files. I need to backup them daily.
I am using Debian and zsh and I use zip
for the tool to backup them.
I am updating the folder from time to time, adding new files, removing old files and updating old files.
I noticed that zip can automatically update a zip file. For instance:
When I run zip -r backup.zip my-folder/
at first, it will add all files.
But when I run the same command zip -r backup.zip my-folder/
again, it will update all the files.
Is that reliable? Or do I need to rm
the zip file every time before I pack my folder?
zip
add a comment |Â
up vote
0
down vote
favorite
I have a folder with some files. I need to backup them daily.
I am using Debian and zsh and I use zip
for the tool to backup them.
I am updating the folder from time to time, adding new files, removing old files and updating old files.
I noticed that zip can automatically update a zip file. For instance:
When I run zip -r backup.zip my-folder/
at first, it will add all files.
But when I run the same command zip -r backup.zip my-folder/
again, it will update all the files.
Is that reliable? Or do I need to rm
the zip file every time before I pack my folder?
zip
3
Another question to consider is whetherzip
is a good tool for doing backups at all. I would rather considerrsnapshot
,borgbackup
or similar.
â Kusalananda
yesterday
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a folder with some files. I need to backup them daily.
I am using Debian and zsh and I use zip
for the tool to backup them.
I am updating the folder from time to time, adding new files, removing old files and updating old files.
I noticed that zip can automatically update a zip file. For instance:
When I run zip -r backup.zip my-folder/
at first, it will add all files.
But when I run the same command zip -r backup.zip my-folder/
again, it will update all the files.
Is that reliable? Or do I need to rm
the zip file every time before I pack my folder?
zip
I have a folder with some files. I need to backup them daily.
I am using Debian and zsh and I use zip
for the tool to backup them.
I am updating the folder from time to time, adding new files, removing old files and updating old files.
I noticed that zip can automatically update a zip file. For instance:
When I run zip -r backup.zip my-folder/
at first, it will add all files.
But when I run the same command zip -r backup.zip my-folder/
again, it will update all the files.
Is that reliable? Or do I need to rm
the zip file every time before I pack my folder?
zip
asked yesterday
AGamePlayer
1,826102742
1,826102742
3
Another question to consider is whetherzip
is a good tool for doing backups at all. I would rather considerrsnapshot
,borgbackup
or similar.
â Kusalananda
yesterday
add a comment |Â
3
Another question to consider is whetherzip
is a good tool for doing backups at all. I would rather considerrsnapshot
,borgbackup
or similar.
â Kusalananda
yesterday
3
3
Another question to consider is whether
zip
is a good tool for doing backups at all. I would rather consider rsnapshot
, borgbackup
or similar.â Kusalananda
yesterday
Another question to consider is whether
zip
is a good tool for doing backups at all. I would rather consider rsnapshot
, borgbackup
or similar.â Kusalananda
yesterday
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
According to man zip
zip will replace identically named entries in the zip archive
So whenever zip
says updating: my-folder/<file> (in=0) (out=0) (stored 0%)
its actually replacing the existing file in the archive
, which is like a Full backup
but not an Incremental or Defferential Backup
. Checkout the example below:
# du -b dir/*
1073741824 dir/file.txt
2 dir/x
0 dir/xx
0 dir/xy
0 dir/y
0 dir/z
# time zip -rv dir.zip dir
adding: dir/ (in=0) (out=0) (stored 0%)
adding: dir/xy (in=0) (out=0) (stored 0%)
adding: dir/x (in=2) (out=2) (stored 0%)
adding: dir/file.txt ...................................................................................................... (in=1073741824) (out=1042051) (deflated 100%)
adding: dir/xx (in=0) (out=0) (stored 0%)
adding: dir/y (in=0) (out=0) (stored 0%)
adding: dir/z (in=0) (out=0) (stored 0%)
total bytes=1073741826, compressed=1042053 -> 100% savings
real 0m10.990s
user 0m10.827s
sys 0m0.160s
# dd if=/dev/zero of=dir/file.txt count=1040 bs=1048576
1040+0 records in
1040+0 records out
1090519040 bytes (1.1 GB) copied, 8.95635 s, 122 MB/s
# du -b dir/file.txt
1090519040 dir/file.txt
Now the file dir/file.txt
has been updated with some extra bytes. Now lets run zip
again:
# time zip -rv dir.zip dir
updating: dir/ (in=0) (out=0) (stored 0%)
updating: dir/xy (in=0) (out=0) (stored 0%)
updating: dir/x (in=2) (out=2) (stored 0%)
updating: dir/file.txt ........................................................................................................ (in=1090519040) (out=1058320) (deflated 100%)
updating: dir/xx (in=0) (out=0) (stored 0%)
updating: dir/y (in=0) (out=0) (stored 0%)
updating: dir/z (in=0) (out=0) (stored 0%)
total bytes=1090519042, compressed=1058322 -> 100% savings
real 0m11.246s
user 0m11.021s
sys 0m0.223s
It just replaced the dir/file.txt
with recently modified file with the same name. This is the same case even if the file doesn't have new content. There are different types of backups like Full, Incremental, Differential available. Typically Incremental and Differential
will come into the picture if the Backup mechanism is designed and put in place for the Data.
In that case as @kusalananda mentioned it would be good if you looked at more versatile tools available to take backups.
For instance rsync
could be of help.
Also rm
need not be run on the existing archived file every time you run the zip
command.
If you want to stick with zip
, go through zip's
add, update, freshen
. For example, Update
case:
# time zip -ruv dir.zip dir
zip diagnostic: dir/ up to date
zip diagnostic: dir/xy up to date
zip diagnostic: dir/x up to date
zip diagnostic: dir/xx up to date
zip diagnostic: dir/y up to date
zip diagnostic: dir/z up to date
updating: dir/file.txt .......................................................................................................... (in=1111490560) (out=1078679) (deflated 100%)
total bytes=1111490562, compressed=1078681 -> 100% savings
real 0m11.351s
user 0m11.178s
sys 0m0.171s
If zip
is run again:
# time zip -ruv dir.zip dir
zip diagnostic: dir/ up to date
zip diagnostic: dir/xy up to date
zip diagnostic: dir/x up to date
zip diagnostic: dir/file.txt up to date
zip diagnostic: dir/xx up to date
zip diagnostic: dir/y up to date
zip diagnostic: dir/z up to date
real 0m0.003s
user 0m0.002s
sys 0m0.001s
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
According to man zip
zip will replace identically named entries in the zip archive
So whenever zip
says updating: my-folder/<file> (in=0) (out=0) (stored 0%)
its actually replacing the existing file in the archive
, which is like a Full backup
but not an Incremental or Defferential Backup
. Checkout the example below:
# du -b dir/*
1073741824 dir/file.txt
2 dir/x
0 dir/xx
0 dir/xy
0 dir/y
0 dir/z
# time zip -rv dir.zip dir
adding: dir/ (in=0) (out=0) (stored 0%)
adding: dir/xy (in=0) (out=0) (stored 0%)
adding: dir/x (in=2) (out=2) (stored 0%)
adding: dir/file.txt ...................................................................................................... (in=1073741824) (out=1042051) (deflated 100%)
adding: dir/xx (in=0) (out=0) (stored 0%)
adding: dir/y (in=0) (out=0) (stored 0%)
adding: dir/z (in=0) (out=0) (stored 0%)
total bytes=1073741826, compressed=1042053 -> 100% savings
real 0m10.990s
user 0m10.827s
sys 0m0.160s
# dd if=/dev/zero of=dir/file.txt count=1040 bs=1048576
1040+0 records in
1040+0 records out
1090519040 bytes (1.1 GB) copied, 8.95635 s, 122 MB/s
# du -b dir/file.txt
1090519040 dir/file.txt
Now the file dir/file.txt
has been updated with some extra bytes. Now lets run zip
again:
# time zip -rv dir.zip dir
updating: dir/ (in=0) (out=0) (stored 0%)
updating: dir/xy (in=0) (out=0) (stored 0%)
updating: dir/x (in=2) (out=2) (stored 0%)
updating: dir/file.txt ........................................................................................................ (in=1090519040) (out=1058320) (deflated 100%)
updating: dir/xx (in=0) (out=0) (stored 0%)
updating: dir/y (in=0) (out=0) (stored 0%)
updating: dir/z (in=0) (out=0) (stored 0%)
total bytes=1090519042, compressed=1058322 -> 100% savings
real 0m11.246s
user 0m11.021s
sys 0m0.223s
It just replaced the dir/file.txt
with recently modified file with the same name. This is the same case even if the file doesn't have new content. There are different types of backups like Full, Incremental, Differential available. Typically Incremental and Differential
will come into the picture if the Backup mechanism is designed and put in place for the Data.
In that case as @kusalananda mentioned it would be good if you looked at more versatile tools available to take backups.
For instance rsync
could be of help.
Also rm
need not be run on the existing archived file every time you run the zip
command.
If you want to stick with zip
, go through zip's
add, update, freshen
. For example, Update
case:
# time zip -ruv dir.zip dir
zip diagnostic: dir/ up to date
zip diagnostic: dir/xy up to date
zip diagnostic: dir/x up to date
zip diagnostic: dir/xx up to date
zip diagnostic: dir/y up to date
zip diagnostic: dir/z up to date
updating: dir/file.txt .......................................................................................................... (in=1111490560) (out=1078679) (deflated 100%)
total bytes=1111490562, compressed=1078681 -> 100% savings
real 0m11.351s
user 0m11.178s
sys 0m0.171s
If zip
is run again:
# time zip -ruv dir.zip dir
zip diagnostic: dir/ up to date
zip diagnostic: dir/xy up to date
zip diagnostic: dir/x up to date
zip diagnostic: dir/file.txt up to date
zip diagnostic: dir/xx up to date
zip diagnostic: dir/y up to date
zip diagnostic: dir/z up to date
real 0m0.003s
user 0m0.002s
sys 0m0.001s
add a comment |Â
up vote
0
down vote
According to man zip
zip will replace identically named entries in the zip archive
So whenever zip
says updating: my-folder/<file> (in=0) (out=0) (stored 0%)
its actually replacing the existing file in the archive
, which is like a Full backup
but not an Incremental or Defferential Backup
. Checkout the example below:
# du -b dir/*
1073741824 dir/file.txt
2 dir/x
0 dir/xx
0 dir/xy
0 dir/y
0 dir/z
# time zip -rv dir.zip dir
adding: dir/ (in=0) (out=0) (stored 0%)
adding: dir/xy (in=0) (out=0) (stored 0%)
adding: dir/x (in=2) (out=2) (stored 0%)
adding: dir/file.txt ...................................................................................................... (in=1073741824) (out=1042051) (deflated 100%)
adding: dir/xx (in=0) (out=0) (stored 0%)
adding: dir/y (in=0) (out=0) (stored 0%)
adding: dir/z (in=0) (out=0) (stored 0%)
total bytes=1073741826, compressed=1042053 -> 100% savings
real 0m10.990s
user 0m10.827s
sys 0m0.160s
# dd if=/dev/zero of=dir/file.txt count=1040 bs=1048576
1040+0 records in
1040+0 records out
1090519040 bytes (1.1 GB) copied, 8.95635 s, 122 MB/s
# du -b dir/file.txt
1090519040 dir/file.txt
Now the file dir/file.txt
has been updated with some extra bytes. Now lets run zip
again:
# time zip -rv dir.zip dir
updating: dir/ (in=0) (out=0) (stored 0%)
updating: dir/xy (in=0) (out=0) (stored 0%)
updating: dir/x (in=2) (out=2) (stored 0%)
updating: dir/file.txt ........................................................................................................ (in=1090519040) (out=1058320) (deflated 100%)
updating: dir/xx (in=0) (out=0) (stored 0%)
updating: dir/y (in=0) (out=0) (stored 0%)
updating: dir/z (in=0) (out=0) (stored 0%)
total bytes=1090519042, compressed=1058322 -> 100% savings
real 0m11.246s
user 0m11.021s
sys 0m0.223s
It just replaced the dir/file.txt
with recently modified file with the same name. This is the same case even if the file doesn't have new content. There are different types of backups like Full, Incremental, Differential available. Typically Incremental and Differential
will come into the picture if the Backup mechanism is designed and put in place for the Data.
In that case as @kusalananda mentioned it would be good if you looked at more versatile tools available to take backups.
For instance rsync
could be of help.
Also rm
need not be run on the existing archived file every time you run the zip
command.
If you want to stick with zip
, go through zip's
add, update, freshen
. For example, Update
case:
# time zip -ruv dir.zip dir
zip diagnostic: dir/ up to date
zip diagnostic: dir/xy up to date
zip diagnostic: dir/x up to date
zip diagnostic: dir/xx up to date
zip diagnostic: dir/y up to date
zip diagnostic: dir/z up to date
updating: dir/file.txt .......................................................................................................... (in=1111490560) (out=1078679) (deflated 100%)
total bytes=1111490562, compressed=1078681 -> 100% savings
real 0m11.351s
user 0m11.178s
sys 0m0.171s
If zip
is run again:
# time zip -ruv dir.zip dir
zip diagnostic: dir/ up to date
zip diagnostic: dir/xy up to date
zip diagnostic: dir/x up to date
zip diagnostic: dir/file.txt up to date
zip diagnostic: dir/xx up to date
zip diagnostic: dir/y up to date
zip diagnostic: dir/z up to date
real 0m0.003s
user 0m0.002s
sys 0m0.001s
add a comment |Â
up vote
0
down vote
up vote
0
down vote
According to man zip
zip will replace identically named entries in the zip archive
So whenever zip
says updating: my-folder/<file> (in=0) (out=0) (stored 0%)
its actually replacing the existing file in the archive
, which is like a Full backup
but not an Incremental or Defferential Backup
. Checkout the example below:
# du -b dir/*
1073741824 dir/file.txt
2 dir/x
0 dir/xx
0 dir/xy
0 dir/y
0 dir/z
# time zip -rv dir.zip dir
adding: dir/ (in=0) (out=0) (stored 0%)
adding: dir/xy (in=0) (out=0) (stored 0%)
adding: dir/x (in=2) (out=2) (stored 0%)
adding: dir/file.txt ...................................................................................................... (in=1073741824) (out=1042051) (deflated 100%)
adding: dir/xx (in=0) (out=0) (stored 0%)
adding: dir/y (in=0) (out=0) (stored 0%)
adding: dir/z (in=0) (out=0) (stored 0%)
total bytes=1073741826, compressed=1042053 -> 100% savings
real 0m10.990s
user 0m10.827s
sys 0m0.160s
# dd if=/dev/zero of=dir/file.txt count=1040 bs=1048576
1040+0 records in
1040+0 records out
1090519040 bytes (1.1 GB) copied, 8.95635 s, 122 MB/s
# du -b dir/file.txt
1090519040 dir/file.txt
Now the file dir/file.txt
has been updated with some extra bytes. Now lets run zip
again:
# time zip -rv dir.zip dir
updating: dir/ (in=0) (out=0) (stored 0%)
updating: dir/xy (in=0) (out=0) (stored 0%)
updating: dir/x (in=2) (out=2) (stored 0%)
updating: dir/file.txt ........................................................................................................ (in=1090519040) (out=1058320) (deflated 100%)
updating: dir/xx (in=0) (out=0) (stored 0%)
updating: dir/y (in=0) (out=0) (stored 0%)
updating: dir/z (in=0) (out=0) (stored 0%)
total bytes=1090519042, compressed=1058322 -> 100% savings
real 0m11.246s
user 0m11.021s
sys 0m0.223s
It just replaced the dir/file.txt
with recently modified file with the same name. This is the same case even if the file doesn't have new content. There are different types of backups like Full, Incremental, Differential available. Typically Incremental and Differential
will come into the picture if the Backup mechanism is designed and put in place for the Data.
In that case as @kusalananda mentioned it would be good if you looked at more versatile tools available to take backups.
For instance rsync
could be of help.
Also rm
need not be run on the existing archived file every time you run the zip
command.
If you want to stick with zip
, go through zip's
add, update, freshen
. For example, Update
case:
# time zip -ruv dir.zip dir
zip diagnostic: dir/ up to date
zip diagnostic: dir/xy up to date
zip diagnostic: dir/x up to date
zip diagnostic: dir/xx up to date
zip diagnostic: dir/y up to date
zip diagnostic: dir/z up to date
updating: dir/file.txt .......................................................................................................... (in=1111490560) (out=1078679) (deflated 100%)
total bytes=1111490562, compressed=1078681 -> 100% savings
real 0m11.351s
user 0m11.178s
sys 0m0.171s
If zip
is run again:
# time zip -ruv dir.zip dir
zip diagnostic: dir/ up to date
zip diagnostic: dir/xy up to date
zip diagnostic: dir/x up to date
zip diagnostic: dir/file.txt up to date
zip diagnostic: dir/xx up to date
zip diagnostic: dir/y up to date
zip diagnostic: dir/z up to date
real 0m0.003s
user 0m0.002s
sys 0m0.001s
According to man zip
zip will replace identically named entries in the zip archive
So whenever zip
says updating: my-folder/<file> (in=0) (out=0) (stored 0%)
its actually replacing the existing file in the archive
, which is like a Full backup
but not an Incremental or Defferential Backup
. Checkout the example below:
# du -b dir/*
1073741824 dir/file.txt
2 dir/x
0 dir/xx
0 dir/xy
0 dir/y
0 dir/z
# time zip -rv dir.zip dir
adding: dir/ (in=0) (out=0) (stored 0%)
adding: dir/xy (in=0) (out=0) (stored 0%)
adding: dir/x (in=2) (out=2) (stored 0%)
adding: dir/file.txt ...................................................................................................... (in=1073741824) (out=1042051) (deflated 100%)
adding: dir/xx (in=0) (out=0) (stored 0%)
adding: dir/y (in=0) (out=0) (stored 0%)
adding: dir/z (in=0) (out=0) (stored 0%)
total bytes=1073741826, compressed=1042053 -> 100% savings
real 0m10.990s
user 0m10.827s
sys 0m0.160s
# dd if=/dev/zero of=dir/file.txt count=1040 bs=1048576
1040+0 records in
1040+0 records out
1090519040 bytes (1.1 GB) copied, 8.95635 s, 122 MB/s
# du -b dir/file.txt
1090519040 dir/file.txt
Now the file dir/file.txt
has been updated with some extra bytes. Now lets run zip
again:
# time zip -rv dir.zip dir
updating: dir/ (in=0) (out=0) (stored 0%)
updating: dir/xy (in=0) (out=0) (stored 0%)
updating: dir/x (in=2) (out=2) (stored 0%)
updating: dir/file.txt ........................................................................................................ (in=1090519040) (out=1058320) (deflated 100%)
updating: dir/xx (in=0) (out=0) (stored 0%)
updating: dir/y (in=0) (out=0) (stored 0%)
updating: dir/z (in=0) (out=0) (stored 0%)
total bytes=1090519042, compressed=1058322 -> 100% savings
real 0m11.246s
user 0m11.021s
sys 0m0.223s
It just replaced the dir/file.txt
with recently modified file with the same name. This is the same case even if the file doesn't have new content. There are different types of backups like Full, Incremental, Differential available. Typically Incremental and Differential
will come into the picture if the Backup mechanism is designed and put in place for the Data.
In that case as @kusalananda mentioned it would be good if you looked at more versatile tools available to take backups.
For instance rsync
could be of help.
Also rm
need not be run on the existing archived file every time you run the zip
command.
If you want to stick with zip
, go through zip's
add, update, freshen
. For example, Update
case:
# time zip -ruv dir.zip dir
zip diagnostic: dir/ up to date
zip diagnostic: dir/xy up to date
zip diagnostic: dir/x up to date
zip diagnostic: dir/xx up to date
zip diagnostic: dir/y up to date
zip diagnostic: dir/z up to date
updating: dir/file.txt .......................................................................................................... (in=1111490560) (out=1078679) (deflated 100%)
total bytes=1111490562, compressed=1078681 -> 100% savings
real 0m11.351s
user 0m11.178s
sys 0m0.171s
If zip
is run again:
# time zip -ruv dir.zip dir
zip diagnostic: dir/ up to date
zip diagnostic: dir/xy up to date
zip diagnostic: dir/x up to date
zip diagnostic: dir/file.txt up to date
zip diagnostic: dir/xx up to date
zip diagnostic: dir/y up to date
zip diagnostic: dir/z up to date
real 0m0.003s
user 0m0.002s
sys 0m0.001s
edited 14 hours ago
answered 15 hours ago
sai sasanka
51517
51517
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f460604%2fis-it-a-good-habit-to-rm-zip-file-before-packing-folders%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
3
Another question to consider is whether
zip
is a good tool for doing backups at all. I would rather considerrsnapshot
,borgbackup
or similar.â Kusalananda
yesterday