Skip to content

Smart Routing

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

๐Ÿ›ฃ๏ธ Smart Virtual Drive Routing

Windows filesystems have a legacy limitation of 260 characters for file paths (MAX_PATH). Android devices (running on a Linux-based kernel) do not have this restriction. If you attempt to sync deeply nested Android folders directly to Windows, long file names or deeply nested paths will cause standard backup applications to fail with path-too-long errors.


๐Ÿ› ๏ธ How Smart Routing Works

  1. At script startup, JigarSmartSync.ps1 dynamically checks for the first available drive letter starting from Z: and going backward (Z:, Y:, X:, etc.).
  2. Once an unused letter is found (e.g. Z:), the script runs the Windows subst command to map the local destination folder directly to that drive letter:
    subst Z: "D:\Backups\My_Backup_Folder"
  3. During the backup, the target path is treated as Z:\, reducing the character path prefix length to just 3 characters! This saves up to 240+ characters of path length and prevents MAX_PATH errors.
  4. When the script exits or is aborted, it automatically unmounts the virtual drive:
    subst Z: /D

๐Ÿ”’ Safety and Cleanups

  • Lock Detection: If a file on Z: is currently in use by Windows Explorer, the unmount command might fail. Jigar Tools runs a 5-iteration retry loop with a 200ms sleep to wait for locks to clear.
  • Auto-Cleanup at Startup: If a virtual drive was left mapped due to an abrupt terminal closure, the next run of the Sync or Restore tool automatically parses current mappings and unmounts them if they point to your backup directories.

Clone this wiki locally