unixcommand-linefindsolaris

How do I get the find command to print out the file size with the file name?


If I issue the find command as follows:

find . -name *.ear

It prints out:

./dir1/dir2/earFile1.ear
./dir1/dir2/earFile2.ear
./dir1/dir3/earFile1.ear

I want to 'print' the name and the size to the command line:

./dir1/dir2/earFile1.ear  5000 KB
./dir1/dir2/earFile2.ear  5400 KB
./dir1/dir3/earFile1.ear  5400 KB

Solution

  • find . -name '*.ear' -print0 | xargs -0 ls -lhS
    

    just the h extra from jer.drab.org's reply. saves time converting to MB mentally ;)