压缩而不创建父文件夹 [英] Zipping without creating parent folder

查看:216
本文介绍了压缩而不创建父文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的文件夹结构:

I have a folder structure like this:

- project:
-- folder 01:
--- file1.cpp
--- file2.cpp
-- folder 02:
--- file1.cpp
--- file2.cpp

我想以一种获得(当我解压缩时)此结构的方式来压缩项目文件夹的内容:

I want to zip the content of the project folder in a way I get(when i unzip) this structure:

- folder 01:
-- file1.cpp
-- file2.cpp
- folder 02:
-- file1.cpp
-- file2.cpp

我的问题是,现在我总是得到一个与包含文件夹01和02的zip文件同名的父文件夹.有没有一种方法可以在不获取此父文件夹的情况下进行zip压缩?

My Problem is now that I always get a parent folder with the same name as my zip file which contains folder 01 and 02. Is there a way I can zip without getting this parent folder ?

推荐答案

zip -r foo ./

zip -r foo ./

假设**

./

**,即当前的工作目录是您的情况下的项目.

** i.e., present working directory is project in your case.

-r用于递归压缩

foo是您的zip文件的名称,即foo.zip是您想要的最终压缩产品.

foo is the name of your zip file, i.e., foo.zip is the final zipped product you want.

这篇关于压缩而不创建父文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆