free file space

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

free file space

Postby 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: 725
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: free file space

Postby Roberthh » Fri Feb 17, 2017 2:52 pm

At least that is the intention of the implementation.


Who is online

Users browsing this forum: Bing [Bot] and 2 guests