0

Say, I have a directory structure like this:

.
├── a
│   ├── d
│   │   ├── file1
│   │   └── file2
│   └── e
│       ├── file1
│       └── file2
└── b
    ├── d
    │   ├── file1
    │   └── file2
    └── e
        ├── file1
        └── file2

I want to count the total byte of files which is modified after a specific date, by their top level directory. So I did this:

find . -type f|sed -e "s/'//g" |xargs -L1 -IA stat -c "%Y,%s,%n" A|cut -d/ -f1,2

which output this:

1479334332,20815368,./a
1479334362,58827575,./a
... ...
1479334383,41663496,./b
1479334413,58925879,./b
... ...

The first column is file modified timestamp, second being file size, last is the top-level directory. Now I want to do aggregation similar to this sql:

SELECT SUM(file_size) WHERE modified_timestamp>... GROUP BY directory

I would like to do this solely in bash, to avoid writing a program for it.

1 Answer 1

0

I found quite some tools to do such thing:

I have tested the first two, both ok, the only thing to mention is their support for CSV without header. I personally suggest q for this reason, but frankly they are mostly identical.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .