[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

RE: Problem with the global weigh of several files



Thank you very much both of you. I think this line was the way I was looking
for:

find ./ -mtime -7 -ls | awk 'BEGIN { s=0 } { s+=$7 } END { print s/1024 } '

Greetings.

> -----Mensaje original-----
> De: Karl Vogel [mailto:vogelke+debian@pobox.com]
> Enviado el: jueves, 26 de mayo de 2011 23:51
> Para: debian-user@lists.debian.org
> Asunto: Re: Problem with the global weigh of several files
> 
> >> On Thu, 26 May 2011 17:12:25 +0200,
> >> "Gorka" <gorkalinux@yahoo.es> said:
> 
> G> I am looking for the best way of appending commands to obtain the
> global
> G> amount of Mb of the modified files of my PC.  Something like this:
> G> find ./ -mtime -7 | du -Sch
> 
> #!/bin/ksh
> # filesize summary; optional argument is starting directory.
> export PATH=/usr/local/bin:/bin:/usr/bin
> 
> case "$1" in
>     "") dir="$HOME" ;;
>     *)  dir="$1" ;;
> esac
> 
> test -d "$dir" || { echo "$dir: not a directory"; exit 1; }
> cd $dir        || { echo "$dir: cannot cd"; exit 2; }
> dir=$(pwd)
> 
> find . -type f -mtime -7 -printf "%s\n" | gawk -v "d=$dir" \
>      'BEGIN { size = 0; }
>      { size += $1; }
>      END {
>        printf "%s: %d new files using %.1f Mb\n", d, NR, size/1048576;
>      }'
> 
> exit 0
> 
> --
> Karl Vogel                      I don't speak for the USAF or my company
> 
> Men are like a fine wine.  They start out as grapes and it's up to women
> to stomp the sh*t out of them until they turn into something acceptable
> to have with dinner.
> 
> 
> --
> To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact
listmaster@lists.debian.org
> Archive:
> [🔎] 20110526215044.41031BE6A@kev.msw.wpafb.af.mil">http://lists.debian.org/[🔎] 20110526215044.41031BE6A@kev.msw.wpafb.af.mil


Reply to: