OSX:终端 Zip 命令不起作用

OSX:终端 Zip 命令不起作用

我正在尝试从终端命令压缩文件夹(如下所示)

zip myZip.zip path\ Of\ the\ Folder

上述命令提供以下结果

在此处输入图片描述

我的命令错了吗?请帮忙,我只能用终端命令来做。

编辑

我也尝试了这些命令,但都不起作用。(也给出了结果)

NO.1

n:~ myUser$ zip -r abc.zip /Users/myUser/Desktop/Assets/img\ for\ seg/
  adding: Users/myUser/Desktop/Assets/img for seg/ (stored 0%)
  adding: Users/myUser/Desktop/Assets/img for seg/aaaa copy 3.jpg (deflated 21%)
  adding: Users/myUser/Desktop/Assets/img for seg/aaaa copy 6.jpg (deflated 21%)
  adding: Users/myUser/Desktop/Assets/img for seg/aaaa copy 64.jpg (deflated 21%)
  adding: Users/myUser/Desktop/Assets/img for seg/aaaa copy 7.jpg (deflated 21%)
  adding: Users/myUser/Desktop/Assets/img for seg/aaaa copy.jpg (deflated 21%)
  adding: Users/myUser/Desktop/Assets/img for seg/aaaa mo e.jpg (deflated 21%)
  adding: Users/myUser/Desktop/Assets/img for seg/aaaa moved.jpg (deflated 21%)
  adding: Users/myUser/Desktop/Assets/img for seg/aaaa.jpg (deflated 21%)
  adding: Users/myUser/Desktop/Assets/img for seg/moved aaaa.jpg (deflated 21%)
  adding: Users/myUser/Desktop/Assets/img for seg/Screen Shot 2015-12-11 at 1.jpg (deflated 21%)
  adding: Users/myUser/Desktop/Assets/img for seg/Screen-Shot-2015-12-11-at-1.17.11-pm_03.png (deflated 19%)
  adding: Users/myUser/Desktop/Assets/img for seg/Screen-Shot-2015-12-11-at-1.17.11-pm_05.png (deflated 21%)
  adding: Users/myUser/Desktop/Assets/img for seg/Screen-Shot-2015-12-11-at-1.17.11-pm_10.png (deflated 26%)
n:~ myUser$ 

2号

n:~ myUser$ zip myZip.zip /Users/myUser/Desktop/Assets/img\ for\ seg
  adding: Users/myUser/Desktop/Assets/img for seg/ (stored 0%)
n:~ myUser$ 

3. 大都会

n:~ myUser$ zip myZip.zip -r /Users/myUser/Desktop/Assets/img\ for\ seg
updating: Users/myUser/Desktop/Assets/img for seg/Screen Shot 2015-12-11 at 1.jpg (deflated 21%)
updating: Users/myUser/Desktop/Assets/img for seg/Screen-Shot-2015-12-11-at-1.17.11-pm_03.png (deflated 19%)
updating: Users/myUser/Desktop/Assets/img for seg/Screen-Shot-2015-12-11-at-1.17.11-pm_05.png (deflated 21%)
updating: Users/myUser/Desktop/Assets/img for seg/Screen-Shot-2015-12-11-at-1.17.11-pm_10.png (deflated 26%)
updating: Users/myUser/Desktop/Assets/img for seg/aaaa copy 3.jpg (deflated 21%)
updating: Users/myUser/Desktop/Assets/img for seg/aaaa copy 6.jpg (deflated 21%)
updating: Users/myUser/Desktop/Assets/img for seg/aaaa copy 64.jpg (deflated 21%)
updating: Users/myUser/Desktop/Assets/img for seg/aaaa copy 7.jpg (deflated 21%)
updating: Users/myUser/Desktop/Assets/img for seg/aaaa copy.jpg (deflated 21%)
updating: Users/myUser/Desktop/Assets/img for seg/aaaa mo e.jpg (deflated 21%)
updating: Users/myUser/Desktop/Assets/img for seg/aaaa moved.jpg (deflated 21%)
updating: Users/myUser/Desktop/Assets/img for seg/aaaa.jpg (deflated 21%)
updating: Users/myUser/Desktop/Assets/img for seg/moved aaaa.jpg (deflated 21%)
updating: Users/myUser/Desktop/Assets/img for seg/ (stored 0%)
n:~ myUser$ 

编辑2:上述命令正在制作一个 zip 文件,但该 zip 文件不包含实际文件夹(源文件夹)中存在的任何内容 在此处输入图片描述

答案1

尝试这个命令

pushd /Users/myUser/Desktop && zip -r ./temp.zip ./Assets && popd

答案2

如果您想压缩文件夹及其内容,则需要-r(递归)选项。

以供参考:

相关内容