 {"id":519684,"date":"2023-01-01T19:45:00","date_gmt":"2023-01-02T02:45:00","guid":{"rendered":"https:\/\/jorgep.com\/blog\/?p=519684"},"modified":"2026-01-01T19:49:15","modified_gmt":"2026-01-02T02:49:15","slug":"dev-log-how-to-properly-zip-and-backup-your-dev-projects","status":"publish","type":"post","link":"https:\/\/jorgep.com\/blog\/dev-log-how-to-properly-zip-and-backup-your-dev-projects\/","title":{"rendered":"Dev Log: How to Properly Zip and Backup Your Dev Projects"},"content":{"rendered":"\n<p>If you&#8217;ve ever tried to move a web project to a thumb drive or upload it to cloud storage, you\u2019ve likely watched in horror as the &#8220;Time Remaining&#8221; jumped from 2 minutes to 2 hours. The culprit? The infamous <code>node_modules<\/code> folder.<\/p>\n\n\n\n<p>As developers, our machines are constantly evolving.  In this post, we\u2019ll look at why that folder is the &#8220;junk drawer&#8221; of your project and how to use PowerShell to create clean, lightweight backups that only include what matters.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">The <code>node_modules<\/code> Rule: Don&#8217;t Backup, Just Rebuild<\/h3>\n\n\n\n<p>It\u2019s a common instinct to want to save everything in your project folder. However, in modern development, <code>node_modules<\/code> is considered <strong>disposable data<\/strong>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Why you should exclude it:<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>The &#8220;Black Hole&#8221; Effect:<\/strong> Even a simple React or Vue project can have 30,000+ tiny files in <code>node_modules<\/code>. Most backup tools (and Windows itself) struggle to process that many small files quickly.<\/li>\n\n\n\n<li><strong>Huge Footprint:<\/strong> You&#8217;re often backing up 500MB of data that is already safely stored on the npm registry.<\/li>\n\n\n\n<li><strong>It\u2019s OS-Specific:<\/strong> Some packages compile &#8220;native binaries&#8221; when you install them. If you backup a project on Windows and restore it on a Mac, the <code>node_modules<\/code> folder will likely be broken anyway.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">What you MUST backup instead:<\/h4>\n\n\n\n<p>You only need two small text files to recreate your entire environment:<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li><strong><code>package.json<\/code><\/strong>: The list of what your project needs.<\/li>\n\n\n\n<li><strong><code>package-lock.json<\/code><\/strong>: The exact &#8220;version map&#8221; that ensures your project builds the same way every time.<\/li>\n<\/ol>\n\n\n\n<p>The Restore Command:<\/p>\n\n\n\n<p>If you lose your files or move to a new PC, just copy your source code and run:<\/p>\n\n\n\n<p>PowerShell<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>npm install\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">How to Zip Your Project (Excluding the Junk)<\/h3>\n\n\n\n<p>When you need to send your code to a colleague or create a manual archive, you want a ZIP file that includes your code but ignores <code>.git<\/code> history and <code>node_modules<\/code>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Method 1: The &#8220;Git Way&#8221; (The Gold Standard)<\/h4>\n\n\n\n<p>If you use Git, this is the fastest way to get a &#8220;clean&#8221; export. It zips only the files Git is actually tracking.<\/p>\n\n\n\n<p>PowerShell<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git archive -o project-clean-backup.zip HEAD\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Method 2: Using 7-Zip (The Pro Choice)<\/h4>\n\n\n\n<p>If you have <a target=\"_blank\" rel=\"noreferrer noopener\" href=\"https:\/\/www.7-zip.org\/\">7-Zip<\/a> installed, you can use its powerful exclusion flags. This is much faster than the built-in Windows &#8220;Send to Compressed Folder&#8221; option.<\/p>\n\n\n\n<p>PowerShell<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>7z a -tzip backup.zip . -xr!node_modules -xr!.git\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>-xr!node_modules<\/code>: Excludes the folder and everything inside it, recursively.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">Method 3: Standard PowerShell (No Extra Tools)<\/h4>\n\n\n\n<p>If you don&#8217;t have Git or 7-Zip, you can use this script. It gathers all items <em>except<\/em> the ones you name, and then zips them.<\/p>\n\n\n\n<p>PowerShell<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$files = Get-ChildItem -Path . -Exclude \"node_modules\", \".git\"\nCompress-Archive -Path $files -DestinationPath project-backup.zip\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Summary Table: Which Zipping Method to Use?<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><td><strong>Scenario<\/strong><\/td><td><strong>Best Tool<\/strong><\/td><td><strong>Why?<\/strong><\/td><\/tr><\/thead><tbody><tr><td><strong>You use Git<\/strong><\/td><td><code>git archive<\/code><\/td><td>Smallest file; respects your <code>.gitignore<\/code> automatically.<\/td><\/tr><tr><td><strong>You want Speed<\/strong><\/td><td><code>7-Zip<\/code><\/td><td>Handles large projects much faster than Windows.<\/td><\/tr><tr><td><strong>No tools installed<\/strong><\/td><td><code>PowerShell<\/code><\/td><td>Built-in to every Windows machine.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>By keeping your backups focused on your <strong>source code<\/strong> rather than your <strong>dependencies<\/strong>, you&#8217;ll save disk space, bandwidth, and a lot of frustration.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you&#8217;ve ever tried to move a web project to a thumb drive or upload it to cloud storage, you\u2019ve likely watched in horror as the &#8220;Time Remaining&#8221; jumped from 2 minutes to 2 hours. The culprit? The infamous node_modules folder. As developers, our machines are constantly evolving. In this post, we\u2019ll look at why&#8230;<\/p>\n","protected":false},"author":2,"featured_media":461826,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","ngg_post_thumbnail":0,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"categories":[441,446],"tags":[674,431,168],"class_list":["post-519684","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech-talk","category-tips-tools-resources","tag-backup","tag-devops","tag-tools-tips"],"taxonomy_info":{"category":[{"value":441,"label":"Tech Talk"},{"value":446,"label":"Tips, Tools &amp; Resources"}],"post_tag":[{"value":674,"label":"backup"},{"value":431,"label":"DevOps"},{"value":168,"label":"Tools &amp; Tips"}]},"featured_image_src_large":["https:\/\/jorgep.com\/blog\/wp-content\/uploads\/jorgep-BlogPostGeneric.jpg",1024,512,false],"author_info":{"display_name":"Jorge Pereira","author_link":"https:\/\/jorgep.com\/blog\/author\/jorge\/"},"comment_info":0,"category_info":[{"term_id":441,"name":"Tech Talk","slug":"tech-talk","term_group":0,"term_taxonomy_id":451,"taxonomy":"category","description":"","parent":0,"count":678,"filter":"raw","cat_ID":441,"category_count":678,"category_description":"","cat_name":"Tech Talk","category_nicename":"tech-talk","category_parent":0},{"term_id":446,"name":"Tips, Tools &amp; Resources","slug":"tips-tools-resources","term_group":0,"term_taxonomy_id":456,"taxonomy":"category","description":"","parent":0,"count":83,"filter":"raw","cat_ID":446,"category_count":83,"category_description":"","cat_name":"Tips, Tools &amp; Resources","category_nicename":"tips-tools-resources","category_parent":0}],"tag_info":[{"term_id":674,"name":"backup","slug":"backup","term_group":0,"term_taxonomy_id":684,"taxonomy":"post_tag","description":"","parent":0,"count":2,"filter":"raw"},{"term_id":431,"name":"DevOps","slug":"devops","term_group":0,"term_taxonomy_id":441,"taxonomy":"post_tag","description":"","parent":0,"count":4,"filter":"raw"},{"term_id":168,"name":"Tools &amp; Tips","slug":"tools-tips","term_group":0,"term_taxonomy_id":180,"taxonomy":"post_tag","description":"","parent":0,"count":64,"filter":"raw"}],"_links":{"self":[{"href":"https:\/\/jorgep.com\/blog\/wp-json\/wp\/v2\/posts\/519684","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jorgep.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jorgep.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jorgep.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jorgep.com\/blog\/wp-json\/wp\/v2\/comments?post=519684"}],"version-history":[{"count":1,"href":"https:\/\/jorgep.com\/blog\/wp-json\/wp\/v2\/posts\/519684\/revisions"}],"predecessor-version":[{"id":519685,"href":"https:\/\/jorgep.com\/blog\/wp-json\/wp\/v2\/posts\/519684\/revisions\/519685"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/jorgep.com\/blog\/wp-json\/wp\/v2\/media\/461826"}],"wp:attachment":[{"href":"https:\/\/jorgep.com\/blog\/wp-json\/wp\/v2\/media?parent=519684"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jorgep.com\/blog\/wp-json\/wp\/v2\/categories?post=519684"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jorgep.com\/blog\/wp-json\/wp\/v2\/tags?post=519684"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}