From 0dd6939da2e0f69b6d8aa97ee863dc4884c0b597 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoffer=20M=C3=BCller=20Madsen?= Date: Fri, 13 Oct 2017 18:54:32 +0200 Subject: [PATCH] parsing 'ls' considered harmful --- update.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update.rb b/update.rb index 3e047df..a3b2752 100644 --- a/update.rb +++ b/update.rb @@ -6,7 +6,7 @@ log_dir = LOG_DIR users.each do |user| size = `du -B1 #{shot_dir}#{user}/ | awk {'print $1'} | head -n 1` - count = `ls -1 #{shot_dir}#{user}/ | wc -l | head -n 1` + count = `find #{shot_dir}#{user}/ -maxdepth 1 -type f | wc -l | head -n 1` [size,count].each do |x| x.delete! "\n"