finding size of total files in a directory
how do I find the total file size in a directory.
while using "du" it don't do the actual file size. for example any file over 1 byte will use 4096 bytes of space(becuase of node)? |
Code:
du -ab |
it won't really show file size though
on my system any file less than 4k will use 4k of space. du shows disk usage not file size. It woult be approximately the same anyway. but is there a way to show total file size in a directory? |
But 4k is how many bytes the file consumes. If the file contains the letter 'A' followed by an EOF, it still consumes 4k on the disk even though the file can be contained in two bytes. I just don't understand why you need to make the distinction aside from an academic perspective. That said, you can use the ls -l command wrapped in a shell script.
Something along the lines of (this is off the top of my head; I make no promises of its quality or that it will even work): Code:
#!/bin/bash 1. recognize directories as anything other than a regular file (in other words, no recursion) 2. count any hidden files (such as .bash_profile) You'd need to flesh it out some more to do that, or search for a different tool. |
All times are GMT -5. The time now is 12:30 PM. |