📲 Download Our Apps

EMI Calculator

Download EMI Calculator

SOA Games

Download SOA Games

SOA Technology App

Download SOA Technology

BMI Checker

Download BMI Checker

Task Jira

Download Task Jira

Laughing Adda

Download Laughing Adda

📅 हिंदी कैलेंडर ऐप डाउनलोड करें

Download Shubhcalendar App

zip all files and folders including hidden

How to use zip command in ubuntu, Linux, Unix

below command include all hidden files.

# zip 1.zip * .[^.]*
$ sudo zip 1.zip * .[^.]*

zip all files and folders including subfolder and hidden files

# zip -r 1.zip your_folder/.

To ignore a folder when using the zip command, utilize the -x option for exclusion.

Here is the general syntax:

Code

zip -r archive_name.zip source_directory -x "source_directory/folder_to_ignore/*"

Explanation:

  • zip -r: This initiates the zip command with recursive inclusion, meaning it will include all subdirectories and files within the source_directory.
  • archive_name.zip: This is the name you want to give your resulting zip file.
  • source_directory: This is the main directory you are zipping.
  • -x: This is the exclude option.
  • "source_directory/folder_to_ignore/*": This specifies the folder to be excluded.
    • source_directory/folder_to_ignore/: This provides the full path to the folder you wish to exclude, relative to the source_directory.
    • *: This wildcard ensures that all contents within folder_to_ignore are also excluded.
    • Quotes ("): Using quotes around the exclusion pattern is important, especially if the path contains spaces or special characters, to prevent the shell from interpreting them.

Example:

To zip a directory named my_project and exclude a subfolder named node_modules:

Code

zip -r my_project_archive.zip my_project -x "my_project/node_modules/*"

Excluding multiple folders:

You can specify multiple folders to exclude by adding more -x options:

Code

zip -r my_project_archive.zip my_project -x "my_project/node_modules/*" -x "my_project/logs/*"

Excluding folders by name (regardless of path):

To exclude any folder with a specific name, regardless of its location within the source directory, you can use a wildcard at the beginning:

Code

zip -r my_project_archive.zip my_project -x "*/node_modules/*"

This would exclude any node_modules folder found within my_project or any of its subdirectories.




Leave a Reply

AI Spiritual Tools & Interactive Experiences

Explore powerful AI-driven tools for daily guidance, spirituality, fun quizzes, and self-discovery.

Today’s Quote

Get inspiring daily quotes powered by AI to motivate and guide your day.

Explore Now

AI Tarot Card Reader

Reveal insights about your future, love, and career with AI tarot readings.

Read Tarot

Love Match Calculator

Check compatibility and love predictions using AI-based analysis.

Check Match

Fortune Cookie

Open an AI fortune cookie and receive wisdom, luck, and fun messages.

Open Cookie

Quiz Categories

Engage with knowledge-based and fun quizzes across multiple categories.

Start Quiz

Panchang Calendar

View daily Panchang, auspicious timings, tithi, nakshatra, and festivals.

View Panchang

Online Numerology

Discover your destiny number, life path, and numerology predictions.

Calculate Now

Spiritual Feeds

Stay connected with spiritual thoughts, mantras, and divine content.

View Feeds

Quiz Hub

Attempt trending quizzes on GK, spirituality, festivals, and more.

Explore Quizzes