Skip to content

Add Windows to WSL2 one-way sync tool#1

Draft
codegen-sh[bot] wants to merge 1 commit intodevelopfrom
gen/b33f85de-bbc7-4e09-ba1d-f52e90b253d3
Draft

Add Windows to WSL2 one-way sync tool#1
codegen-sh[bot] wants to merge 1 commit intodevelopfrom
gen/b33f85de-bbc7-4e09-ba1d-f52e90b253d3

Conversation

@codegen-sh
Copy link

@codegen-sh codegen-sh bot commented Mar 22, 2025

This PR adds PowerShell scripts to enable continuous one-way synchronization from a Windows folder to a WSL2 folder.

Features

  • Real-time monitoring of Windows folder for changes using FileSystemWatcher
  • Efficient file copying using robocopy
  • Batched synchronization to prevent excessive operations
  • Detailed logging of all activities
  • Handles file creation, modification, deletion, and renaming
  • Includes a script to set up the sync as a scheduled task

Files Added

  1. windows-wsl2-sync.ps1 - The main script that monitors and syncs folders
  2. windows-wsl2-sync-readme.md - Documentation with usage instructions
  3. setup-scheduled-task.ps1 - Helper script to set up the sync as a Windows scheduled task

Usage

The script can be run with the following command:

.\windows-wsl2-sync.ps1 -SourcePath "C:\Users\L\Desktop\WORKSPACE" -DistroName "Ubuntu" -DestPath "/home/l/Workspace"

This will continuously monitor the Windows folder and sync any changes to the WSL2 folder.

@codegen-sh codegen-sh bot mentioned this pull request Mar 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants