code: def get_free_diskbytes(dir_):
      r
      if WIN32:
          import ctypes
          free_bytes = ctypes.c_ulonglong(0)
          outvar = ctypes.pointer(free_bytes)
          dir_ptr = ctypes.c_wchar_p(dir_)
          ctypes.windll.kernel32.GetDiskFreeSpaceExW(dir_ptr, None, None, outvar)
          bytes_ = free_bytes.value
          return bytes_
      else:
          st = os.statvfs(dir_)
          # blocks avaiable * block size
          bytes_ = st.f_bavail * st.f_frsize
          #bytes_ = st.f_bfree * st.f_frsize  # includes root only space
          return bytes_
docs: r"""
      Args:
          dir_ (str):
  
      Returns:
          int: bytes_ folder/drive free space (in bytes)
  
      References::
          http://stackoverflow.com/questions/51658/cross-platform-space-remaining-on-volume-using-python
          http://linux.die.net/man/2/statvfs
  
      CommandLine:
          python -m utool.util_cplat --exec-get_free_diskbytes
          python -m utool.util_cplat --exec-get_free_diskbytes --dir /media/raid
          python -m utool.util_cplat --exec-get_free_diskbytes --dir E:
  
      Example:
          >>> # ENABLE_DOCTEST
          >>> from utool.util_cplat import *  # NOQA
          >>> import utool as ut
          >>> dir_ = ut.get_argval('--dir', type_=str, default=ut.truepath('~'))
          >>> bytes_ = get_free_diskbytes(dir_)
          >>> result = ('bytes_ = %s' % (str(bytes_),))
          >>> print(result)
          >>> print('Unused space in %r = %r' % (dir_, ut.byte_str2(bytes_)))
          >>> print('Total space in %r = %r' % (dir_, ut.byte_str2(get_total_diskbytes(dir_))))