From the command line, how do I zip specific files and directories into one compressed folder?

Ecnalyr

I'm working in a directory that looks like this:

folder
  >.git
  >css
  >img
  >js
  Archive.zip
  bla.html
  bla.yml

During work on this project I very regularly have to zip up the contents of this folder with the exception of Archive.zip and the .git directory (the new zipped folder needs to replace the previous Archive.zip file).

I am doing this by shift-selecting the appropriate files > right clicking > compressing . This is not as efficient as it could be.

Is it possible to use the zip command from the command line to accomplish this? Or would I be better off writing a custom command to do this?

Matija Nalis

run from that directory:

rm Archive.zip; zip Archive.zip -r . --exclude '.git/*'

rm will remove old Archive.zip (you need to do that, or zip will just UPDATE the current content of Archive.zip); zip -r . will add all directories and folders recursively, and --exclude '.git/*' will exclude given directories.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to ZIP specific files from a folder using Winzip command line?

From Dev

How do I move all files from one folder to a subfolder except .html file using the command line?

From Dev

How to update multiple compressed files with 7zip command line?

From Dev

How do I copy all files of one specific type from a folder to another folder in Python

From Dev

How do I zip up multiple files on command line?

From Dev

How do I only copy files to a remote folder on another server that don't already exist in the folder... from the command line in linux?

From Dev

How do I disable 7-Zip directory scan for directories which are not meant to be compressed and added to the archive?

From Dev

How do I compile and link multiple files from the command line?

From Dev

How do I FTP multiple files from the command line?

From Dev

How do I move files and directories to the parent folder in Linux?

From Dev

How do I batch rename a specific file inside multiple zip archives via the command line?

From Dev

How do I delete all empty directories in a directory from the command line?

From Dev

How do I import protobuf files from one folder in another folder in Eclipse?

From Dev

How do I overwrite image files (in a folder) with one file with command prompt?

From Dev

How to make a line of directories with one command?

From Dev

Recursively zip files into .cbz-files based on folder in command line

From Dev

how can I move files with specific names from one folder to another

From Dev

do not compress just zip files in command line

From Dev

How do I partially suppress the command-line output of zip?

From Dev

How do I partially suppress the command-line output of zip?

From Dev

How do I determine the total size of a directory (folder) from the command line?

From Dev

How do I determine the total size of a directory (folder) from the command line?

From Dev

Linux Centos 6,64 - How do I add a first line in many files from a folder?

From Dev

How do I find the biggest file in a folder and subfolders on the command line?

From Dev

SourceSafe add files into specific project directories via command line

From Dev

Execute command line from a specific folder

From Dev

How do I get a list of only the files (not the directories) from a package?

From Dev

How do I get a list of only the files (not the directories) from a package?

From Dev

How do I batch copy files sequentially from one folder to another?

Related Related

  1. 1

    How to ZIP specific files from a folder using Winzip command line?

  2. 2

    How do I move all files from one folder to a subfolder except .html file using the command line?

  3. 3

    How to update multiple compressed files with 7zip command line?

  4. 4

    How do I copy all files of one specific type from a folder to another folder in Python

  5. 5

    How do I zip up multiple files on command line?

  6. 6

    How do I only copy files to a remote folder on another server that don't already exist in the folder... from the command line in linux?

  7. 7

    How do I disable 7-Zip directory scan for directories which are not meant to be compressed and added to the archive?

  8. 8

    How do I compile and link multiple files from the command line?

  9. 9

    How do I FTP multiple files from the command line?

  10. 10

    How do I move files and directories to the parent folder in Linux?

  11. 11

    How do I batch rename a specific file inside multiple zip archives via the command line?

  12. 12

    How do I delete all empty directories in a directory from the command line?

  13. 13

    How do I import protobuf files from one folder in another folder in Eclipse?

  14. 14

    How do I overwrite image files (in a folder) with one file with command prompt?

  15. 15

    How to make a line of directories with one command?

  16. 16

    Recursively zip files into .cbz-files based on folder in command line

  17. 17

    how can I move files with specific names from one folder to another

  18. 18

    do not compress just zip files in command line

  19. 19

    How do I partially suppress the command-line output of zip?

  20. 20

    How do I partially suppress the command-line output of zip?

  21. 21

    How do I determine the total size of a directory (folder) from the command line?

  22. 22

    How do I determine the total size of a directory (folder) from the command line?

  23. 23

    Linux Centos 6,64 - How do I add a first line in many files from a folder?

  24. 24

    How do I find the biggest file in a folder and subfolders on the command line?

  25. 25

    SourceSafe add files into specific project directories via command line

  26. 26

    Execute command line from a specific folder

  27. 27

    How do I get a list of only the files (not the directories) from a package?

  28. 28

    How do I get a list of only the files (not the directories) from a package?

  29. 29

    How do I batch copy files sequentially from one folder to another?

HotTag

Archive