Sample Header Ad - 728x90

How to find files by size that are not divisible by 4096 and round them up

6 votes
1 answer
703 views
In Linux in a Folder there are many files, all created with fallocate with random size. How to find files whose size is not divisible by 4096 and correct the filesize (rounded up) to a multiple of 4096? They can be found with : find . -type f -printf '%s\t%p\n' | awk -F'\t' '{size=$1; file=$2; if (size % 4096 != 0) print file}' But how to size them up that the filesize is divisible by 4096 ?
Asked by Banana (189 rep)
Jun 16, 2025, 01:34 AM
Last activity: Jun 16, 2025, 11:29 PM