From: tomás zerolo Date: Sun, 20 Nov 2022 14:00:38 +0000 (+0100) Subject: filesizes: skip symlinks X-Git-Url: http://git.tuxteam.de/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fmain;p=susannes-git%2Fmathe%2Fstats%2Fhisto.git filesizes: skip symlinks --- diff --git a/filesizes.py b/filesizes.py index 893432e..69d29c9 100755 --- a/filesizes.py +++ b/filesizes.py @@ -17,7 +17,8 @@ def collectdir(direc): exit(1) for it in direc.iterdir(): - if os.access(it, os.R_OK): # ignore otherwise + if os.access(it, os.R_OK) and not it.is_symlink(): + # ignore otherwise if it.is_file(): sizes += [it.stat().st_size] elif it.is_dir():