in reply to Re: Getting the size of files and stuff
in thread Getting the size of files and stuff

$ cd /foo/bar ; ln -s . snaretrap

Now watch that code run forever.

Check for symlinks before you recurse. Of course, if several files are hardlinked to each other below /foo/bar/, they will be counted multiple times, which may or may not be desired - likely not. stat files and check if you've seen that combination of device and inode number before. Etc etc etc..

It's only an innocent looking problem.

Makeshifts last the longest.

  • Comment on Re^2: Getting the size of files and stuff