假设我想压缩这个目录〔c:/Users/xah/ErgoEmacs_Source/ergoemacs/build-util/〕
我希望输出目录为(c:/Users/xah/xx2/)
(我当前的目录可能在任何地方。我在一个elisp程序中调用zip ),所以我这样做了
zip -r c:/Users/xah/xx2/build-util.zip c:/Users/xah/ErgoEmacs_Source/ergoemacs/build-util/然后zip将记录完整路径,如下所示
adding: Users/xah/ErgoEmacs_Source/ergoemacs/build-util/ (stored 0%)
adding: Users/xah/ErgoEmacs_Source/ergoemacs/build-util/.svn/ (stored 0%)
adding: Users/xah/ErgoEmacs_Source/ergoemacs/build-util/.svn/all-wcprops (deflated 56%)
...我希望路径只从build-util开始。
注意:我在程序中调用zip (elisp),并且我不能或不想使用任何环境变量的概念。
有没有可能使用一些zip参数?
发布于 2011-03-10 02:01:47
奇怪的是,您的最佳选择可能是使用Java JDK中的jar。
c:/Users/xah/ErgoEmacs_Source/ergoemacs/build-util/构建c:/ -cMf /xah/xx2/ -C -util.zip。
"-M“告诉jar不要创建清单文件,而-C则告诉jar在开始压缩文件之前更改目录。我基于此的文档在这里:http://download.oracle.com/javase/tutorial/deployment/jar/build.html
发布于 2011-04-12 06:22:13
我最喜欢的bash函数之一是pushd,它保存您当前所在的目录,并将您移动到您指定的目录。倒数函数是popd,它会让你返回到pushd之前所在的目录。例如,您可以这样做
pushd c:/Users/xah/ErgoEmacs_Source/ergoemacs
zip -r c:/Users/xah/xx2/build-util.zip build-util/
popd我想你最终会得到你想要的。
https://stackoverflow.com/questions/4291737
复制相似问题