Last active
December 7, 2020 08:33
-
-
Save duchenpaul/f9c25456e7c9eee4f771b73106a1cde3 to your computer and use it in GitHub Desktop.
Convert windows path to wsl path
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'''Convert windows path to wsl path''' | |
import sys | |
windows_path = sys.argv[1] | |
MOUNT_PATH = '/mnt' | |
windows_path_split = windows_path.split(':\\') | |
diskLabel, path = windows_path_split[0].lower(), windows_path_split[1].replace('\\', r'''/''').replace(' ', r'''\ ''') | |
wsl_path = '/'.join((MOUNT_PATH, diskLabel, path)) | |
print(wsl_path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment