Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from subprocess import call
- import shutil
- import pathlib
- NO_WINDOW = 0x08000000
- def mount_network(share, drive, user=None, password=None):
- mount_cmd = ['net', 'use', drive, share]
- if user:
- mount += ['/user:{}'.format(user), password]
- print(' '.join(mount_cmd))
- return call(mount_cmd, shell=False, creationflags=NO_WINDOW)
- def umount_network(drive):
- mount_cmd = ['net', 'use', drive, '/DELETE']
- return call(mount_cmd, shell=False, creationflags=NO_WINDOW)
- share = r'\\ANDRE-GP70-2PE\Downloads'
- drive = 'f:'
- user = None
- password = None
- desktop_path = pathlib.Path.home() / 'Desktop'
- mount_network(share, drive)
- shutil.copy(r'F:\pIqaD.ttf', desktop_path)
- umount_network(drive)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement