This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

find misreports file size when using %b, %k


The "find -printf" escapes %b and %k should return filesize in 512-byte blocks and in 1k blocks, respectively. Instead, %b returns size in 1k blocks, and %k returns size in 2k blocks; i.e. the values are half those expected. %s, filesize in bytes, works correctly. Is this standard behavior, or Patches Gratefully Accepted? (Win2k, NTFS, Cygwin ver 1.3.12-4)

$ dd if=/dev/null of=foo bs=1024 count=0 seek=1000
0+0 records in
0+0 records out

$ ls -la foo
-rw-r--r-- 1 steveb None 1024000 Aug 30 22:03 foo

$ du -sk foo
1000 foo

$ find -name "foo" -printf "%s %b %k"
1024000 1000 500

$ find --version
GNU find version 4.1.7

From find.info:

Size Directives
...............

`%k'
     File's size in 1K blocks (rounded up).

`%b'
     File's size in 512-byte blocks (rounded up).

`%s'
     File's size in bytes.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]