You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
697 B
28 lines
697 B
from ctypes import windll
|
|
import os
|
|
# https://stackoverflow.com/a/827397
|
|
def get_drives():
|
|
uppercase = map(chr,range(ord('A'),ord('A')+26))
|
|
drives = []
|
|
bitmask = windll.kernel32.GetLogicalDrives()
|
|
for letter in uppercase:
|
|
if bitmask & 1:
|
|
drives.append(f'{letter}:\\')
|
|
bitmask >>= 1
|
|
|
|
return drives
|
|
|
|
def no_parents(paths):
|
|
paths = sorted(paths,key=len)
|
|
ret = []
|
|
paths
|
|
while len(paths) > 0:
|
|
el1 = paths[0]
|
|
ret.append(el1)
|
|
old_paths = paths[1:]
|
|
paths = []
|
|
for path in old_paths:
|
|
|
|
if not path.startswith(el1):
|
|
paths.append(path)
|
|
return ret
|