Zip including hidden files

后端 未结 5 390
心在旅途
心在旅途 2021-01-30 01:31

In Linux I can zip all(except hidden files) in current directory by doing:

zip 1.zip *

But how do I include the hidden files?

相关标签:
5条回答
  • 2021-01-30 01:50

    Or you can add more simple

    zip 1.zip ./
    
    0 讨论(0)
  • 2021-01-30 01:51

    EDIT: The correct way is zip -r 1.zip .

    The commands shown in my previous answer below are incorrect because they also include the parent directory.


    Have you tried this:

    zip yourfile.zip sourcedir/* .*
    

    or you in your case

    zip 1.zip * .[^.]*'
    

    It should include all hidden files also.

    0 讨论(0)
  • 2021-01-30 01:52

    Just to be sure it is not forgotten since this is a forum for developers and a good number of us use git.

    An easy way to get only what you want in the zip is to use git archive -o filename.zip branch

    0 讨论(0)
  • 2021-01-30 01:58

    if you don't have rights to save zip file in current dir you can go to dir where you have rights and type

    zip -r 1.zip /path/to/source/dir/.
    

    However when if in .../some_dir you type

    unzip 1.zip
    

    then your files will be decompress into .../some_dir/path/to/source/dir/

    0 讨论(0)
  • 2021-01-30 02:02

    If you want to zip all files (+hidden files) Kindly using: zip -r namefiles.zip . The "." is all files in folder.

    zip -r namefiles.zip "folder will zip"
    
    0 讨论(0)
提交回复
热议问题