Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python get volume free space

import ctypes
import os
import platform
import sys

def get_free_space_mb(dirname):
    """Return folder/drive free space (in megabytes)."""
    if platform.system() == 'Windows':
        free_bytes = ctypes.c_ulonglong(0)
        ctypes.windll.kernel32.GetDiskFreeSpaceExW(ctypes.c_wchar_p(dirname), None, None, ctypes.pointer(free_bytes))
        return free_bytes.value / 1024 / 1024
    else:
        st = os.statvfs(dirname)
        return st.f_bavail * st.f_frsize / 1024 / 1024
Comment

PREVIOUS NEXT
Code Example
Python :: 2 variables with statement python 
Python :: how to create empty series in pandas 
Python :: how to print python 
Python :: how to change a header in pandas 
Python :: create age-groups in pandas 
Python :: networkx path between two nodes 
Python :: python gui using css 
Python :: pandas difference between dates 
Python :: sort dictionary by value python 
Python :: print column in 2d numpy array 
Python :: how to say something python 
Python :: left join outer apply 
Python :: pandas test for nan 
Python :: pyspark join 
Python :: how to print time python 
Python :: increase colorbar ticksize 
Python :: how to install from url in python 
Python :: how to change os path in python 
Python :: finding the Unique values in data 
Python :: append a zeros column numpy 
Python :: roots of quadratic equation in python 
Python :: matplotlib logarithmic scale 
Python :: fixed precision float python 
Python :: discord.py embeds 
Python :: opencv waitkey example 
Python :: pytorch get gpu number 
Python :: list sort by key python 
Python :: pandas select columns by index 
Python :: install python in centos7 
Python :: create new list in for loop python 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =