1# The QDirStat File Age Statistics Window
2
3See also [GitHub issue #172](https://github.com/shundhammer/qdirstat/issues/172).
4
5QDirStat can break down the _age_ of files (based on their modification time)
6in a subtree by year and, for the current year and the year before, by
7months. This is strictly for files; directories, symlinks etc. are disregarded.
8
9This is a new view opened from the menu with _View_ -> _Show File Age
10Statistics_ or with the `F4` key. If a directory is selected, it starts with
11that directory, otherwise with the complete subtree.
12
13![File Age Statistics: Years](https://github.com/shundhammer/qdirstat/blob/master/screenshots/QDirStat-file-age-years.png)
14
15For each year, it shows:
16
17- The number of files that were last modified in that year
18
19- The percentage of those files relative to the selected subtree, both as a
20  percent bar and as a number
21
22- The total size of files that were last modified in that year
23
24- The percentage of those files relative to the selected subtree, both as a
25  percent bar and as a number.
26
27
28
29## Breaking Down to Months
30
31For the current year and the year before, you can expand the months (click on
32the little arrows on the left).
33
34![File Age Statistics: Years and Months](https://github.com/shundhammer/qdirstat/blob/master/screenshots/QDirStat-file-age-months.png)
35
36
37## Directories with no Activity for some Years
38
39![File Age Statistics: Years and Months](https://github.com/shundhammer/qdirstat/blob/master/screenshots/QDirStat-file-age-months.png)
40
41The list always starts with the current year, even if there was no activity in
42the subtree in that year (i.e. no file was modifed in that year). All inactive
43years up to the last year with any activity are displayed.
44
45This helps to quickly see at a glance that there was a while with no activity,
46even without reading the year numbers.
47
48
49## Drilling Down Deeper into Subdirectories
50
51Simply leave the _File Age Statistics_ window open and click on another
52directory in the main window's tree view, and the _File Age Statistics_ window
53is automatically updated with the data for that directory.
54
55You can also switch that behaviour off when you uncheck the _Sync with Main
56Window_ check box at that bottom of the _File Age Statistics_ window. In that
57case, you can always simply hit the `F4` key again to update the window.
58
59
60## Locating Files from that Year / Month
61
62If there are no more than 1000 files in the selected year or month, you can use
63the _Locate_ button to open another pop-up window that lists those files. Click
64on one of them to select it in the main window; the main window scrolls to that
65branch, selects the file and updates the _Details_ panel with it.
66
67This is limited to 1000 files because it becomes very unwieldy at some point,
68and performance suffers heavily. If you find yourself wanting to see more than
691000 files in a subtree, break it down to deeper subdirectories (see above).
70
71
72## Use Case
73
74This view was inspired by the discussion in
75[GitHub issue #165](https://github.com/shundhammer/qdirstat/issues/165)
76where an admin requested this for his users that had accumulated large amounts
77of data and lost their overview.
78
79It had become necessary to move some of those data to archive media, but the
80users had lost the overview what was current and what was not, i.e. which parts
81were good candidates to be moved to archive media.
82
83Imagine a large machine with a large storage array used by a great number of
84scientists collecting research data over many years. Researchers come and go;
85new ones take over their projects and their data for their research. Others
86leave when they are finished with their degree. Even with a best effort of
87documentation (which is wishful thinking to begin with), after some time it
88becomes murky what set of research data is what, and which of them are in
89active use. Somebody new will not dare to get rid of anything; even if that
90only means moving it to archive media where it's less easily accessible.
91
92While this _File Age Statistics_ is by no means a general solution, it can
93contribute to regain some kind of overview: If a directory branch has been
94completely unmodified for many years, this is an indication that it may not be
95in active use.
96
97Of course, this is not guaranteed: It is very well possible that they are
98actively using the data sets from 1995, 2000, this year and the year before,
99and the old data sets are a reference that does not change. Only the users can
100really tell. But the file age may give them additional hints.
101
102
103## Usage Hints
104
105It depends on the use case which columns in the _File Age Statistics_ are more
106important: The number of files in that year (or month) or their total
107size. That's why both of them are displayed.
108
109When it comes to the relevance of data in a subdirectory, the sheer number of
110files may be important: Even a lot of small files that accumulated may distract
111and get in the way, especially when scripting (`find` commands come to mind)
112over large directory trees.
113
114When that is not an issue, but disk space is running out, of course the total
115size of those files may be more important.
116
117One use case is showcased in
118[GitHub issue #172](https://github.com/shundhammer/qdirstat/issues/172):
119
120A photo collection that grew over the years. In that case, the number of files
121is much more important than their total size: During those years, camera
122technology rapidly advanced, moving from 3 Megapixels up to 10, then 12, then
12324. That means that photos taken in earlier years with considerably less
124Megapixels are of course much smaller, so for photo activity during those years
125the size is not a good measure; but the number of photos per year is.
126
127
128### Get an Overview Quickly
129
130Start at the top of the subtree. Arrange the windows so you can see both the
131important part of the main window and the _File Age Statistics_ window.
132
133If the _File Age Statistics_ for the toplevel don't give a good overview (which
134is likely), click on its first subdirectory in the main window's tree
135view. Watch the _File Age Statistics_ window.
136
137Then use the _Cursor Down_ key in the main window to go to the next
138subdirectory. Watch the _File Age Statistics_ window; but it's enough to give
139it just a glance: Watch how the inactive years (the greyed-out entries)
140change. Move to the next subdirectory etc.; you will now have a first
141impression on the age distribution among that first subdirectory level.
142
143If that also doesn't shed much light, go to the next deeper subdirectory level
144in the main window. Since the main window's tree view orders the directories by
145size by default, starting from the top is most promising.
146
147If repeating that over several subdirectory levels still doesn't give you an
148overview, this may not be the right tool for the job; it's not a catch-all
149solution for every situation.
150
151
152## Related Discovery Actions
153
154Don't forget that there are also actions in the _Discover_ menu to immediately
155find the oldest and the newest files in a directory tree. This is meant for
156individual (or at least small numbers) of very old or very new files.
157
158
159## Related Main Window Tree View Columns
160
161
162### Last Modified
163
164In the main window, the _Last Modified_ tree column shows the latest
165modification time in that subtree, but in _including_ directories and
166symlinks. That may or may not be what you need; it depends on the task.
167
168Notice that a directory's modification time is updated whenever a file is
169created or deleted there, or whenever a file is moved to or out of that
170directory.
171
172
173### Oldest File
174
175This may be little known since it is not enabled by default, but there is a
176similar column _Oldest File_ in the main window's tree view that shows the
177modification time of the oldest file (not directory, not symlink) in that
178subtree. This may be useful to drill down the tree view for very old files.
179
180To activate that column, switch to an appropriate main window layout
181(preferable L2 or L3), right-click on the headers of the tree view to open the
182context menu, then select _Hidden Colunns_ -> _Show Column "Oldest File"_.
183
184This functionality may be superseded by the relatively new _Show Oldest Files_
185action in the _Discover_ menu.
186
187
188
189## Reference
190
191- [GitHub issue #172](https://github.com/shundhammer/qdirstat/issues/172)
192- [GitHub issue #165](https://github.com/shundhammer/qdirstat/issues/165)
193