In this answer https://askubuntu.com/a/216889/50183 I found a command to list all files, filled with zeros:

find -type f -printf "%S\t%p\n" 2>/dev/null | awk '{if ($1 < 1.0) print $1 $2}'

unfortunately, it can't capture filenames and pathes with spaces.

How to improve?


This is a bit of a red herring - find is capturing the files and printing the names correctly. All you need to do is have awk print the whole record instead of just the first two fields:

find -type f -printf "%S\t%p\n" 2>/dev/null | awk '{if ($1 < 1.0) print $0}'

or instead, tell it to only split on tabs, not any whitespace:

find -type f -printf "%S\t%p\n" 2>/dev/null | awk -F"\t" '{if ($1 < 1.0) print $1 $2}'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.