I have a find command that will print size and filename(along with full path) of the 20 largest files on the given directory and write it into a file:
find ${DIR} -type f -size +1M -exec du -h '{}' + | sort -hr|awk '{print $1","$2}'|head -20 >>files.csv The problem is, there exist some files with spaces in their file names. These file names are only printed till the first space.
Ex: A file named 'hello there.txt' is printed as 'hello'
I tried setting the IFS to '\n',
i.e. IFS=$'\n', but the problem still persists.
Any help will be much appreciated.
Thanks!