This straightforward approach doesn't seem to work:

In[42]:= cmd = StringSplit@"zip -r ~/data.zip ~/test/*"
In[43]:= RunProcess@cmd

enter image description here

Related: How can I encrypt/decrypt a directory?

  • $\begingroup$ Try the less straightforward approach that doesn't assume zip will do wildcard expansion, which is the job of the shell... this is nothing to do with Mathematica, it seems to me. $\endgroup$ Jan 18, 2016 at 23:35
  • $\begingroup$ Are you aware of CreateArchive? $\endgroup$
    – C. E.
    Jan 19, 2016 at 0:54
  • $\begingroup$ But this command works in the terminal @OleksandrR. $\endgroup$
    – M.R.
    Jan 19, 2016 at 0:55
  • $\begingroup$ @Pickett Forgot that one, yup that solves it. But it would be nice to understand why this command that works in the shell won't work when invoked with RunProcess. If you post this as an answer I'll accept. $\endgroup$
    – M.R.
    Jan 19, 2016 at 0:57
  • $\begingroup$ @M.R. what do you expect? The purpose of "the terminal" is to run a shell. Try execing zip directly from C and see if it works--I bet it won't. $\endgroup$ Jan 19, 2016 at 1:25

1 Answer 1


Since Mathematica 8.0 we are in luck and there is a command called CreateArchive that can do this for us. Documentation: CreateArchive.


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