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
Here is a version that is less noisy.
Is it bad practice to add methods to Base?
function Base.filesize(dirpath::String, recursive::Bool)
if !recursive
return filesize(dirpath)
else
total = 0
for (root,dirs,files) in walkdir(dirpath)
total += filesize(root)
for f in files
file = joinpath(root,f)
size = filesize(file)
total += size
end
end
return total
end
end