free file space

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
User avatar
devnull
Posts: 473
Joined: Sat Jan 07, 2017 1:52 am
Location: Singapore / Cornwall
Contact:

free file space

Post by devnull » Fri Feb 17, 2017 12:34 pm

Can someone confirm that this method is correctly calculating the available disk space ?

Code: Select all

def df(dir='/'):
	from os import statvfs
	s = statvfs(dir)
	print((s[0]*s[3]) / 1048576,'MB')

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: free file space

Post by Roberthh » Fri Feb 17, 2017 2:52 pm

At least that is the intention of the implementation.

Post Reply