Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zip including hidden files

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?

like image 535
john-jones Avatar asked Sep 19 '12 10:09

john-jones


People also ask

Can zip files be hidden?

To hide a file from common Zip applications, simply un-check it. To remove a file from the archive, mark it in the left list and press [delete]. You can extract any files, hidden or not, by marking them and clicking "Extract selected files".

How do I zip an entire folder?

-r Option: To zip a directory recursively, use the -r option with the zip command and it will recursively zips the files in a directory. This option helps you to zip all the files present in the specified directory.

Can hidden files be found?

Open File Explorer from the taskbar. Select View > Options > Change folder and search options. Select the View tab and, in Advanced settings, select Show hidden files, folders, and drives and OK.


1 Answers

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.

like image 67
Gunnar Avatar answered Sep 19 '22 13:09

Gunnar