Unable to Zip one subfolder and exclude all subfolders

Collapse

Unconfigured Ad Widget

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Rex Maughan
    Senior Member
    • Mar 2022
    • 220

    Unable to Zip one subfolder and exclude all subfolders

    VPS Hosting
    Hey, I have a problem when zipping a folder. Let's say I have a folder Project with node_modules to be excluded, but I want to include only node_modules/mydir in my zip.

    Any Suggestions?
  • Clay Page
    Senior Member
    • Sep 2022
    • 127

    #2
    Your problem can be solved by using the zip command with -x to exclude everything under node_modules/ except node_modules/mydir.

    Just run the following command:


    zip -r project.zip Project -x "Project/node_modules/*" "Project/node_modules/mydir/*"

    Hope it works.

    Comment

    Working...
    X