Skip to content

Smart Routing

official-Arvind edited this page Jun 19, 2026 · 2 revisions

🛣️ Smart Virtual Drive Routing

Windows filesystems enforce a legacy path length limitation of 260 characters (MAX_PATH). However, Android (Linux kernel) has no such limit. This creates a critical error when copying deeply nested Android folders to a Windows PC, leading to silent backup failures or file skipping.


🛠️ The Architecture

Jigar Tools solves the MAX_PATH issue dynamically without requiring registry hacks or admin policy modifications:

graph TD
    A[Start Sync / Restore] --> B[Find first unused drive letter from Z: backward]
    B --> C[Map backup directory to virtual drive e.g. subst Z: path]
    C --> D[Run sync operations using Z:/ as target root]
    D --> E[Sync completes / aborts]
    E --> F[Unmount virtual drive subst Z: /D]
Loading

💡 Key Design Highlights

1. Dynamic Drive Mapping

At script execution, JigarSmartSync.ps1 checks for available drive letters going backwards from Z: to E:. Once an unused letter is found, it maps the path instantly:

subst Z: "D:\Backups\My_Extremely_Deep_Android_Backup_Folder_Here"

The target root path is shortened from D:\Backups\My_Extremely_Deep_Android_Backup_Folder_Here\ to Z:\, saving up to 240+ characters of path length.

2. Lock Detection & Retries

Windows Explorer often locks virtual drives if they are currently viewed. Jigar Tools runs a 5-iteration cleanup retry loop with a 200ms sleep window to wait for system hooks to clear before forcibly unmounting.

3. Leftover Auto-Cleanup

If a terminal is forcibly closed, the mapping may persist. On startup, Jigar Tools automatically queries active virtual drives using:

subst

It cleans up any matching local backup directory drives left from previous sessions, maintaining a clean system workspace.

Clone this wiki locally