Date: Fri, 18 Jan 2013 17:39:50 -0600 From: Dan Nelson <dnelson@allantgroup.com> To: Fbsd8 <fbsd8@a1poweruser.com> Cc: FreeBSD questions <questions@freebsd.org> Subject: Re: sh script code to get file size. Message-ID: <20130118233950.GA5709@dan.emsphone.com> In-Reply-To: <50F9DA3E.5050607@a1poweruser.com> References: <50F9DA3E.5050607@a1poweruser.com>
next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Jan 18), Fbsd8 said: > In a script in am working on I need to find out the allocated > size of a sparse file. > The only command that comes to mind is "ls -lh" > The "du -h" command is not appropriate because it will show > the occupied size and not the allocated size. > > I don't know how to parse out to the position in the output of that > "ls -lh" command to pickup the file size value. > > Is there some other way to do this? For a single file, you can get the exact filesize with "stat -f %z filename". For the human-friendly version, "du -hA" will work. -- Dan Nelson dnelson@allantgroup.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130118233950.GA5709>