Re: Get total size of all files in directory using unit Bytes?

2013-03-04 Thread Paolo Aglialoro
Great one! How to put that nice expression into an alias without console complaining when executed? # ls -l | awk '{ SUM += $5 } END { print SUM }' 569047 # alias tot=ls -l | awk '{ SUM += $5 } END { print SUM }' # tot awk: syntax error at source line 1 context is { SUM +=} awk:

Re: Get total size of all files in directory using unit Bytes?

2013-03-04 Thread Jiri B
On Mon, Mar 04, 2013 at 12:32:32PM +0100, Paolo Aglialoro wrote: Great one! How to put that nice expression into an alias without console complaining when executed? A shell function instead of an alias? jirib

Re: Get total size of all files in directory using unit Bytes?

2013-03-04 Thread Paul de Weerd
On Mon, Mar 04, 2013 at 12:32:32PM +0100, Paolo Aglialoro wrote: | Great one! | How to put that nice expression into an alias without console complaining | when executed? | | | # ls -l | awk '{ SUM += $5 } END { print SUM }' | 569047 | | # alias tot=ls -l | awk '{ SUM += $5 } END { print SUM }'

Re: Get total size of all files in directory using unit Bytes?

2013-03-04 Thread Otto Moerbeek
On Mon, Mar 04, 2013 at 12:54:49PM +0100, Paul de Weerd wrote: On Mon, Mar 04, 2013 at 12:32:32PM +0100, Paolo Aglialoro wrote: | Great one! | How to put that nice expression into an alias without console complaining | when executed? | | | # ls -l | awk '{ SUM += $5 } END { print SUM }'

Re: Get total size of all files in directory using unit Bytes?

2013-03-04 Thread Paul de Weerd
On Mon, Mar 04, 2013 at 12:57:05PM +0100, Otto Moerbeek wrote: | On Mon, Mar 04, 2013 at 12:54:49PM +0100, Paul de Weerd wrote: | | On Mon, Mar 04, 2013 at 12:32:32PM +0100, Paolo Aglialoro wrote: | | Great one! | | How to put that nice expression into an alias without console complaining | |

Re: Get total size of all files in directory using unit Bytes?

2013-03-04 Thread f5b
At 2013-03-04 20:13:46,Paul de Weerd we...@weirdnet.nl wrote: Exactly!  So what is the point in summing up the sizes of a bunch of files ?  I am 197 cm tall, my house number is 34, my zipcode is 1318, I have 2 brothers and 1 sister .. sum is 1552.  Great, but now what ? This total value does not 

Re: Get total size of all files in directory using unit Bytes?

2013-03-04 Thread Michael Lambert
On 4 Mar 2013, at 10:02, f5b wrote: Maybe because we come from Windows system. In Windows, sum files' size by Byte is a simple quick way to check if thousands of files are modified/sync/same, although not accurate. openssl {md5|sha1|...} *

Re: Get total size of all files in directory using unit Bytes?

2013-03-04 Thread Otto Moerbeek
On Mon, Mar 04, 2013 at 11:02:47PM +0800, f5b wrote: At??2013-03-04??20:13:46,Paul??de??Weerd??we...@weirdnet.nl??wrote: Exactly!So??what??is??the??point??in??summing??up??the??sizes??of??a??bunch??of files???I??am??197??cm??tall,??my??house??number??is??34,??my??zipcode??is??1318,

Re: Get total size of all files in directory using unit Bytes?

2013-03-04 Thread Ted Unangst
On Mon, Mar 04, 2013 at 12:54, Paul de Weerd wrote: On Mon, Mar 04, 2013 at 12:32:32PM +0100, Paolo Aglialoro wrote: | Great one! | How to put that nice expression into an alias without console complaining | when executed? I may be an oddball here, but I prefer just making little shell

Re: Get total size of all files in directory using unit Bytes?

2013-03-04 Thread David Diggles
Or with subdirectories find . -type f -ls | awk '{sum += $7} END {print sum}'

Get total size of all files in directory using unit Bytes?

2013-03-03 Thread f5b
for example 1. there is only two file in /home/test/ # ls -l /home/test/ total 8 -rw-r--r-- 1 root wheel 2 Mar 3 23:29 a.txt -rw-r--r-- 1 root wheel 3 Mar 3 23:29 b.txt So the total size of all files ( a.txt + b.txt ) should be 5 Bytes. How to get total size ( 5 Bytes ) directly but not

Re: Get total size of all files in directory using unit Bytes?

2013-03-03 Thread Paul de Weerd
Not really an answer to your question, I know, but what would such a number mean ? What use do you have for it ? On Mon, Mar 04, 2013 at 12:01:25AM +0800, f5b wrote: | for example | | 1. | there is only two file in /home/test/ | # ls -l /home/test/ | total 8 | -rw-r--r-- 1 root wheel 2 Mar

Re: Get total size of all files in directory using unit Bytes?

2013-03-03 Thread Ted Unangst
On Sun, Mar 03, 2013 at 22:02, Paul de Weerd wrote: [weerd@despair] $ ls -l /tmp/test/* | awk '{SUM+=$5} END {print SUM}' heh. :) ~/bin cat filesizes #!/bin/sh ls -l $@ | awk '{sum += $5} END { print sum }'