Skip to content

Instantly share code, notes, and snippets.

@duchenpaul
Last active December 7, 2020 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save duchenpaul/f9c25456e7c9eee4f771b73106a1cde3 to your computer and use it in GitHub Desktop.
Save duchenpaul/f9c25456e7c9eee4f771b73106a1cde3 to your computer and use it in GitHub Desktop.
Convert windows path to wsl path
'''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