Quantcast
Channel: How can I create a zip archive of a whole directory via terminal without hidden files? - Ask Ubuntu
Viewing all articles
Browse latest Browse all 9

Answer by Rinzwind for How can I create a zip archive of a whole directory via terminal without hidden files?

$
0
0

Add " to the .* (otherwise, your shell expands .* to the dot files in the current directory), and also exclude hidden files in subdirectories:

zip -r zipfile.zip . -x ".*" -x "*/.*"

This will result in files starting with a . not to be added into your zip file.

rinzwind@discworld:~/tmp$ ls -ladrwxr-xr-x  2 rinzwind rinzwind 4096 2011-08-28 00:15 tmpdrwxr-xr-x  2 rinzwind rinzwind 4096 2011-08-28 00:15 .tmprinzwind@discworld:~/tmp$ zip -r zipfile.zip . -x .*adding: .tmp/ (stored 0%)adding: tmp/ (stored 0%)rinzwind@discworld:~/tmp$ zip -r zipfile.zip . -x ".*" -x "*/.*"updating: tmp/ (stored 0%)

Viewing all articles
Browse latest Browse all 9

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>