3 篇文章带有标签 “archive”

macOS 下的 __MACOSX 目录和 .DS_Store 文件

.DS_Store 文件

.DS_Store 是 Desktop Services Store 的缩写。

.DS_Store 是 macOS 操作系统中隐藏的文件,它存储有关文件夹的元数据,例如文件夹中的文件位置、文件夹的显示选项和自定义图标等信息。这些元数据是用来帮助操作系统更快地显示文件夹中的内容,并记住用户的偏好设置。这些文件只是本地的,不会在网络文件共享时传输,因此不会影响其他操作系统用户。

__MACOSX 目录

当你在 Mac 电脑上创建一个压缩文件时,系统会自动在压缩文件中添加一个名为 __MACOSX 的目录。该目录包含了 Mac 操作系统专有的一些文件,如 .DS_Store 等。这些文件不会对压缩文件的解压缩造成影响,但它们可能会在其他操作系统上解压缩时出现问题,例如在 Windows 上解压缩时可能会显示 __MACOSX 目录或 .DS_Store 文件。为了避免这种情况,你可以在创建压缩文件时选择不包含 Mac 专有文件,或者在解压缩时手动删除 __MACOSX 目录和 .DS_Store 文件。

删除 __MACOSX 目录和 .DS_Store 文件 方法一 find . -name '__MACOSX' -exec rm -rf {} ; -o -name '.

命令tar

    -c, --create Create a new archive.  Arguments supply the names of the files to be archived.
    -x, --extract, --get Extract files from an archive.
    -z, --gzip, --gunzip, --ungzip Filter the archive through gzip(1).
    -j, --bzip2 Filter the archive through bzip2(1).
    -f, --file=ARCHIVE Use archive file or device ARCHIVE.  If this option is not given, tar will first examine the environment variable `TAPE'.  If it is set, its value will be used as the archive  name.   Otherwise, tar will assume the compiled-in default.
    -t, --list List the contents of an archive.
    -v, --verbose Verbosely list files processed.

命令zip

准备 yolov5

yolov5/
├── detect.py
├── Dockerfile
├── hubconf.py
├── LICENSE
├── models
│   ├── common.py
│   ├── experimental.py
│   ├── export.py
│   ├── __init__.py
│   ├── yolo.py
│   ├── yolov5l.yaml
│   ├── yolov5m.yaml
│   ├── yolov5s.yaml
│   └── yolov5x.yaml
├── README.md
├── requirements.txt
├── test.py
├── train.py
├── tutorial.ipynb
└── weights
    └── download_weights.sh

打包整个目录

zip -r yolov5.zip yolov5/

排除目录和文件

打包前,最好把之前的 zip 文件删除,不然是增量追加,还会看到排除的目录和文件。

zip -r yolov5.zip yolov5/ -x "yolov5/.git/*" -x "yolov5/.github/*" -x "yolov5/.gitattributes"

排除所有的 yaml 文件 zip -r yolov5.