zip error: Nothing to do!
(/Users/petermarks/Desktop/orbus/public/1/daily/2007-10-29.zip)
I’ve seen some tutorials for archiving using the rubyzip gem, but they
all involve manually moving files into an archive instead of archiving
an existing directory. I’m assuming rubyzip is overkill for this?
You must list some files for it to zip, or at least a wildcard *.
At least on Linux / Cygwin, the command to make a zip archive from a
directory is
$ zip archive-file.zip /path/to/archive
The first parameter is the output archive file name and the second
parameter is the path you want to archive. So what it’s complaining
about is that you didn’t give it the output archive file name, just the
path that you wanted to archive.
Thanks for the help guys. I am developing in osx and will deploy in
ubuntu (this is for a rails app). My original command does not work in
the command line, nor does zip --help on my local machine.
The command you suggested, Ed, gives the following response:
The archive it produces contains the folders of the intended archive’s
path, but not the contents of the “2007-10-29” folder. I need to archive
the contents of that folder. Any other ideas?
zip -r archive.zip
Users/petermarks/Desktop/orbus/public/1/daily/2007-10-29/
I forgot the “-r” (for recursive).
Thanks Ed, that archives the contents of “2007-10-29”. Do you know if
there is a way to make the new archive only contain the contents of
“2007-10-29” and not the folders of the path leading to it?
zip -r archive.zip
Users/petermarks/Desktop/orbus/public/1/daily/2007-10-29/
I forgot the “-r” (for recursive).
Thanks Ed, that archives the contents of “2007-10-29”. Do you know if
there is a way to make the new archive only contain the contents of
“2007-10-29” and not the folders of the path leading to it?
$ cd /Users/petermarks/Desktop/orbus/public/1/daily/
$ zip -r archive.zip 2007-10-29
There’s another way, but I don’t remember what it is.
zip -r archive.zip
Users/petermarks/Desktop/orbus/public/1/daily/2007-10-29/
I forgot the “-r” (for recursive).
Thanks Ed, that archives the contents of “2007-10-29”. Do you know if
there is a way to make the new archive only contain the contents of
“2007-10-29” and not the folders of the path leading to it?
$ cd /Users/petermarks/Desktop/orbus/public/1/daily/
$ zip -r archive.zip 2007-10-29
There’s another way, but I don’t remember what it is.
$ cd /Users/petermarks/Desktop/orbus/public/1/daily/
$ zip -r archive.zip 2007-10-29
There’s another way, but I don’t remember what it is.
I think I’ll digg up that other way in order to write this into a ruby
function. Thanks again for you guidance Ed.
Isn’t there a Ruby library that does this without calling the
command-line function?
Actually, that doesn’t work because the cd system() call executes in a
separate subprocess, so the zip system() call that executes in its own
subprocess can’t see the changed directory. You need to execute both
commands in the same subprocess, so you would have to write it like
this:
system(“cd /Users/autie/2testing; zip -r zipped_rails_app4 ./dir3”)
Gee whiz, I can’t get anything straight tonight. In your case, it would
be like this:
Actually, that doesn’t work because the cd system() call executes in a
separate subprocess, so the zip system() call that executes in its own
subprocess can’t see the changed directory. You need to execute both
commands in the same subprocess, so you would have to write it like
this:
system(“cd /Users/autie/2testing; zip -r zipped_rails_app4 ./dir3”)