![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to know size of file in a directory | kittusri9 | Shell Programming and Scripting | 1 | 04-28-2008 09:43 AM |
| Create Year directory, date subdirectory and archive the file | madhunk | UNIX for Dummies Questions & Answers | 2 | 12-13-2007 11:25 AM |
| calculate size of some files | big123456 | Shell Programming and Scripting | 11 | 07-22-2005 06:07 PM |
| How to calculate file's size in directory and subdirectory | KLL | Shell Programming and Scripting | 4 | 10-16-2003 08:02 AM |
| how to calculate the file size? | rooh | UNIX for Dummies Questions & Answers | 3 | 08-17-2001 02:45 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
calculate directory size by year of file
I need to calcualte the size of a directory [and all it's subdirectories] by the year the files in that directory were created [or last accessed].
For example the script will sum up, by year, the number of blocks for that directory and its' subdirectories for files created / accessed in that year. I need a report that would look like this :- year 2000 50000 blocks year 2001 2000 blocks year 2002 45000 blocks year 2003 150 blocks ...etc...etc thru year 2006. I think I need to do this usings awk, but I'm not certain. any ideas? Thanks, igidttam |
|
||||
|
I tried your code and it doesn't total by year. It does it by month.
Looks like it's all the same. There should be a different number of total bytes per year > find . -type f -ls | nawk '{arr[$8] += $7} END {for (i in arr) prin tf("%s -> [%d]\n", i, arr[i])}' Apr -> [2147483647] Jun -> [2147483647] 5 -> [0] 25 -> [0] Oct -> [2147483647] Sep -> [2147483647] Nov -> [2147483647] Mar -> [2147483647] May -> [2147483647] Dec -> [2147483647] Jan -> [2147483647] Aug -> [2147483647] Jul -> [2147483647] Feb -> [2147483647] |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|