EDITED: Added more information
First of all, I am a bash noob, so please be gentle
I am trying to sum the size of folders that are in different places but have the same name. It looks like this :
root
--- directory 1
------ folder 1
--------subfolder 1
--------subfolder 2
------ folder 2
--------subfolder 3
--------subfolder 4
------ folder 3
--------subfolder 5
--------subfolder 6
--- directory 2
------ folder 1
--------subfolder 1
--------subfolder 2
------ folder 2
--------subfolder 3
--------subfolder 4
------ folder 3
--------subfolder 5
--------subfolder 6
I am trying to sum the size of subdirectories 1 to 6 and output that to a .csv
At the moment I am simply outputting sizes of subdirectories in two seperate CSV files. One for directory 1 and one for directory 2
At the moment I have this to output sizes of subfodlers that I run where I need them :
du -h --max-depth=1 --block-size=GB * | grep "[\/]" | sort -n -r > ~/lists/disks/RC_job.csv
The output look like this :
40GB folder1/subfolder1
15GB folder1/subfolder2
10GB folder2/subfolder 3
...
I have one output for directory 1 and one for directory 2. I would like to sum the size of subfolders from directory one and two and have an output that looks like this
60GB subfolder1
25GB subfolder2
10GB subfolder3
Where subfolder1 is directory1/folder1/subfolder1 + directory2/folder1/subfolder1
This is my first post here I do not know if this enough info. I would be pleased to provide more if necessary. I am pretty sure this can be done with awk, but I haven't really used that yet.
Cheers !