I'm trying to write a program, calcsize
, that calculates the size of all sub directories. I want to create a cache of the result and only re-walk the directory if it has changed since the last time I've run the program.
Something like:
./calcsize
//outputs
/absolute/file/path1/ 1000 Bytes
/absolute/file/path2/ 2000 Bytes
I'm already walking the dirs with my own walk implementation because the built in go filepath.Walk
is already calling Lstat
on every file.
Is there any way to know if a directory or set of files has changed without calling Lstat
on every file? Maybe a system call I'm not aware of?