Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2005
    Posts
    23

    Unanswered: Get the size of a file

    Hi !

    I need to get the size of a file, and if this is possible, it would be great: I need a command that I can pass the filename to, and that would return the size of the file. It's not important to be in bytesm human readable or other...I just want to check if the file is empty or not!

    Thanks in advance,
    Chris

  2. #2
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    test -s filename # True if filename exists and has a size greater than zero.
    or get size with wc or
    ls -l filename | read x x x x filesize x

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •