Handling varying exclude folders for source code backup of MERN, React Native, Android and DotNet tech stacks

Quick-Info

Tech Stack-Specific Source Code Backup Exclude Folders:
  1. React Native: android, ios, node_modules, .expo, .gradle
  2. Android: build, release, .gradle, .idea
  3. DotNET: bin, obj, node_modules
  4. Others (MERN Stack, Java): node_modules .next .gradle .idea .cache .expo build target
(Windows) Powershell scripts I use for copying MERN, React Native, Android and DotNet tech stacks project source code folders and files are available on my public GitHub repo:  https://github.com/ravisiyer/PS-Scripts which has a README doc. The repo has some other Powershell scripts too.

Details

Given below is a summary of my chat with Gemini, “Exclude Folders for various dev platforms”, on 25 to 26 July 2025. The copy-paste from Microsoft Word document  had some formatting issues. I spent some time on fixing the major related issues but not all issues are fixed.

Tech Stack-Specific Source Code Backup Exclusions 

1. React Native Projects
  • Exclude folders: android, ios, node_modules, .expo, .gradle
2. Android Projects (Native Java/Kotlin Android Studio projects)
  • Exclude folders: build, release, .gradle, .idea
3. Java Projects ( occasional Maven project)
  • Exclude folders: target, build, .idea
4. VB.NET, C#.NET Projects
  • Exclude folders: bin, obj, node_modules
5. Others - MERN Stack / Node.js Projects (e.g., Express API, React frontend, Next.js, etc.)
  • Exclude folders: node_modules, build, .cache, .next (if Next.js)

Project folders recommended organization

  1. CurrProj for actively modified projects and ReadProj for reading/reference only projects.
  2. When project-folder in ReadProj needs modification, it should first be moved to CurrProj.
  3. Within ReadProj and CurrProj, organize by Tech Stack-wise folders:
    • ReactNative
    • Android
    • Java
    • DotNET
    • Others
  4. VSCode's files.readonlyInclude user setting can configure read-only mode for all files within a folder, such as ReadProj, in the VSCode editor.
  5. Applying filesystem-level read-only permissions to the entire ReadProj folder might allow viewing in VSCode, but Android Studio/IDEA would most likely encounter issues.

Miscellaneous

  1. For efficient and precise exclusions with robocopy on Windows, organizing by tech stack allows me to leverage the /XD switch most effectively and maintain a cleaner, more reliable backup script.
  2. On organizing by client or my own app name folders, I may not have a single robocopy command for the entire top-level folder as the exclude folders could be different for different tech stack folders within the top-level client or my own app name folders.
  3. A limitation of Robocopy's /XD (exclude directories) switch is that it operates on directory names, not on relative paths or patterns within the directory structure. 
  4. A single, free, sophisticated, and universally "well-tested" backup program specifically designed for Windows to intelligently parse .gitignore files across various tech stacks to pick up only source code for general file system backup is not a common, readily available, out-of-the-box solution. 
  5. Microsoft’s Windows Subsystem for Linux WSL and open-source and mature rsync utility together could provide me highly granular control over exclusions, including patterns, specific relative paths (within the context of a project), and dynamic generation from .gitignore. But that brings in complexity for my use case. Given my priorities of reliability, performance with native Windows filesystems, and minimal setup/complexity, sticking with robocopy and tech-stack-based directory structure is a better solution for my use case.
  6. The concern with using a custom script that recursively traverses down the directory structure and identifies the tech-stack of project-folders encountered and then uses appropriate exclude folders for robocopy command for that project-folder is that backup is a critical operation. Custom scripts could have bugs resulting in some key data not being copied onto the backup. In contrast if I am depending mainly or only on robocopy and its exclude directory feature then I am using a Microsoft tested and supported program used by many, many people over many years and so is reported to be very stable and reliable.
--- end Gemini chat summary ---

I later expanded the exclude folders for Others (project type) to: "node_modules .next .gradle .idea .cache .expo build target". So Java projects exclude folders: target, build, .idea , became part of the Others project type. Then I moved Java projects to Others folder.

Then I reorganized the source code of projects on my PC to the above with one exclusion as of now. Next I updated my Powershell project source code copy scripts to use these new exclude folders.
The exclusion I have now is for an app that has a Node Express and STRAPI backend and a React Native frontend. I handle the source code backup of this app by using small custom scripts for them which I have to run individually for each project folder (backend and frontend with different exclude folders).

My previous posts related to these Powershell scripts:
Additionally MERN stack (and short Android) dev notes: Feb to Apr 2025 (includes Powershell scripts for copying and listing swdev project source code) has small content related to this post but almost all of that content is covered in this post and so that part can be skipped. However, the above post has some additional notes related to Powershell which may be of interest to some readers.

Comments