LINUX UNIX

UNIX – LINUX – Zip all files in directory

Trying to zip all files in directory:

  • The Command to zip all files in a Directory would :
bash code
zip -r <filename.zip> <directory>

Example:

bash code
zip -r mydata.zip mydata

OR

bash code
zip -r mydata.zip mydata/*
  • Where r is for zip the Directory Recursively.

zip each file into its own archive, so you did the following (in zsh):

javascript code
$ for file in *; do zip ${file%.*}.zip $file; done

zip all files in directory:

bash code
cd /path/to/your/folder/www
zip -r filename.zip *

Optionally

bash code
mv filename.zip /some/other/path
READ  Difference between Linux and Unix

About the author

Wikitechy Editor

Wikitechy Editor

Wikitechy Founder, Author, International Speaker, and Job Consultant. My role as the CEO of Wikitechy, I help businesses build their next generation digital platforms and help with their product innovation and growth strategy. I'm a frequent speaker at tech conferences and events.

X