data_sharing.sh is a Bash script designed to facilitate seamless file transfers between Windows Subsystem for Linux (WSL) and Windows environments. The script provides an interactive menu-driven interface for bidirectional file and directory transfers.
- Bidirectional file transfer between WSL and Windows
- Interactive menu interface
- Directory structure inspection tool
- Detailed logging system
- Support for both file and directory transfers
- Configurable source and destination directories
- Windows Subsystem for Linux (WSL) installed
- Bash shell environment
- Read/Write permissions in both Windows and Linux directories
- Copy the script to your desired location in WSL
- Make the script executable:
chmod +x data_sharing.sh
The script uses the following default directory structure if no parameters are provided:
- Source:
/mnt/c/Users/<username>/Desktop/linux_sharing/export-zone - Destination:
/mnt/c/Users/<username>/Desktop/linux_sharing/land-zone
- Source:
<current_directory>/export-zone - Destination:
<current_directory>/land-zone
./data_sharing.sh./data_sharing.sh <windows_source_dir> <windows_dest_dir> <linux_source_dir> <linux_dest_dir>- Import from Windows
- Export to Windows
e: Exit
- File Transfer
- Directory Transfer
- Inspect Source Directory
- Change Source Directory
b: Back to Main Menu
The inspector tool provides basic file system navigation and inspection capabilities:
Available commands:
ls: List directory contentscat: Display file contentsclear: Clear screenexit: Exit inspector
Note: The inspector tool is restricted to the source directory tree for security purposes.
The script maintains detailed logs of all transfer operations:
- Log Location:
./logs/YYYY_MM_DD.log - Logs include:
- System information
- Transfer operations
- Success/Failure status
- Timestamps
The script uses color coding for better visibility:
- Red: Errors
- Yellow: Warnings
- Green: Success
- Blue: Information
- Restricted directory navigation
- Permission checks
- Error handling for file operations
- Logging of all operations
The script includes comprehensive error handling for:
- File/directory existence checks
- Permission issues
- Transfer operations
- Invalid user input
- Cannot navigate outside source directories in the inspector tool
- Command options are not supported in the inspector tool
- Requires appropriate permissions in both Windows and Linux environments
- Ensure proper permissions are set for source and destination directories
- Regularly check logs for any transfer issues
- Use relative paths when specifying files/directories for transfer
- Keep the directory structure organized
- If transfers fail, check:
- Directory permissions
- File existence
- Path validity
- Consult the log files for detailed error information
- Ensure WSL has proper access to Windows directories