Is there a built-in function to get the size of a folder?

I tried the code below and I think it works now.

using Logging
function totalsize(dirpath)
	total = 0
	for (root,dir,files) in walkdir(dirpath)
		total += filesize(root)
		@info filesize(root) root
		for f in files
			file = joinpath(root,f)
			size = filesize(file)
			total += size
			@info size file
		end
		print(" "^80,"\r")
		print(total," B","\r")
	end
end
1 Like