What is the current full install size of Cygwin?

A full Cygwin installation can range from 23 to 112 GiB, depending on how you define “full.” Your 100 MB number tells me that you just clicked through the defaults presented by Cygwin’s setup-*.exe program, selecting no optional packages, because that installs only the Base package set, which currently amounts to 0.1 GiB. Cygwin follows the modern … Read more

Get amount of free disk space using Go

On POSIX systems you can use sys.unix.Statfs. Example of printing free space in bytes of current working directory: import “golang.org/x/sys/unix” import “os” var stat unix.Statfs_t wd, err := os.Getwd() unix.Statfs(wd, &stat) // Available blocks * size per block = available space in bytes fmt.Println(stat.Bavail * uint64(stat.Bsize)) For Windows you need to go the syscall route … Read more

TFS creates a $tf folder with gigabytes of .gz files. Can I safely delete it?

TFS keeps a hash and some additional information on all file in the workspace so that it can do change tracking for Local Workspaces and quickly detect the changes in the files. It also contains the compressed baseline for your files. Binary files and already compressed files will clog up quite a bit of space. … Read more

Disk usage of files whose names match a regex, in Linux?

I suggest something like: find . -regex ‘.*\.bak’ -print0 | du –files0-from=- -ch | tail -1 Some notes: The -print0 option for find and –files0-from for du are there to avoid issues with whitespace in file names The regular expression is matched against the whole path, e.g. ./dir1/subdir2/file.bak, not just file.bak, so if you modify … Read more

How to check if IOException is Not-Enough-Disk-Space-Exception type?

You need to check the HResult and test against ERROR_DISK_FULL (0x70) and ERROR_HANDLE_DISK_FULL (0x27), which can be converted to HResults by OR‘ing with 0x80070000. For .Net Framework 4.5 and above, you can use the Exception.HResult property: static bool IsDiskFull(Exception ex) { const int HR_ERROR_HANDLE_DISK_FULL = unchecked((int)0x80070027); const int HR_ERROR_DISK_FULL = unchecked((int)0x80070070); return ex.HResult == HR_ERROR_HANDLE_DISK_FULL … Read more

Cross-platform space remaining on volume using python

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 Note that you must pass a directory name for GetDiskFreeSpaceEx() … Read more

du counting hardlinks towards filesize?

Hardlinks are real references to the same file (represented by its inode). There is no difference between the “original” file and a hard link pointing to it as well. Both files have the same status, both are then references to this file. Removing one of them lets the other stay intact. Only removing the last … Read more

tech