socialnerds/hive
socialnerds
/
hive
Archived
1
0
Fork 0
This repository has been archived on 2020-12-06. You can view files and clone it, but cannot push or open issues or pull requests.
hive/diskusage_diezweite.py

22 lines
712 B
Python
Executable File

#!/usr/bin/python2
import os
class partobj(object): #my first class :)
# def __init__(self):
# self.dev = ""
# getting all local partitions plus their uuids
def getpartitions(self):
self.uuids = os.listdir("/dev/disk/by-uuid") #folder contains symlinks to the actual disk devices
self.parts = {} #initializing empty dictionary for partitions and uuids
for self.uuid in self.uuids: #write /dev/names as keys and uuids as values in the dictionary
self.parts["/dev/" + os.readlink("/dev/disk/by-uuid/" + self.uuid)[6:]] = self.uuid
return self.parts #return the dictionary for further useage
test = partobj()
bla = test.getpartitions()
print bla