Published: 2026-10
The first draft of anything is shit. - Ernest Hemingway
To write a paper you need to go through a lot of versions. During the process, a common problem that arises is how to name and archive different versions. Typically you start with a nice filename, but end up with something horrible, filled with ad-hoc suffixes:
# this is how it started
Decunta_ms.docx
# this is how it ends
Decunta_ms_v11_FINAL_2.docx
Besides the problem of maintaining version numbers, co-authors usually add their initials in caps as a suffix:
# suppose Lionel Andres Messi (LAM) revised version 10:
Decunta_ms_v10_LAM.docx
This is a good convention. However, you usually receive revisions
from various co-authors for the same version, so you end up with
Decunta_ms_v4_LAM.docx, Decunta_ms_v4_AD.docx,
Decunta_ms_v4_EM.docx, or whatever.
The “archive” directory ends up in a mess like this:
Decunta_ms.docx
Decunta_ms_v1.docx
Decunta_ms_v2.docx
Decunta_ms_v2_JD.docx
Decunta_ms_v3.docx
Decunta_ms_v3_JD.docx
Decunta_ms_v3_RC.docx
Decunta_ms_v4.docx
Decunta_ms_v4_RC_JD.docx
# etc, etc
My two main problems with this are:
Missing dates: dates are useful when searching emails related to some version.
Missing minor versions: for example, you are working on
v3 but have some doubts about the path you are taking, so
you decide to do some branching: save the current file in case you
change your mind, and work in another direction. But you know this is
still version 3, so the filename is not changed.
Of course both problems can be solved by including that information in the filenames. But there is a better way!
“Lo viejo funciona, Juan” - Favalli, El Eternauta.
I got the idea from an article written by the great Jerry Peek. The article is called Filenames by Design, Part One.
This is the thing: use directories to create a date-based archive.
Each file needs three directories: year, month, and day of month. Then, your version dated 18 December 2022 will look like this:
archive/2022/12/18/ms_FINAL.docx
This not only gives you dates but also lets you archive multiple
minor versions. For example, if you have three different versions of
v3:
archive/2025/08/20/Foo_ms_v3.docx
archive/2025/08/22/Foo_ms_v3.docx
archive/2025/08/24/Foo_ms_v3.docx
An important note here: use zero-padded dates. This is super useful for sorting, as shown below.
You can create those directories by hand or use a script. I use a shell script to create the date directories and save a copy of a specified file.
The good part is that once you have this system, you can use Unix tools to search for specific files.
This part requires some knowledge of the command line and basic Unix tools.
With this kind of archive, having all versions sorted by date is trivial:
$ find archive/ -type f | sort -r
archive/2025/09/26/Foo_ms_v5_AD.docx
archive/2025/09/24/Foo_ms_v5.docx
archive/2025/09/20/Foo_ms_v4.docx
archive/2025/09/05/Foo_ms_v3_LAM.docx
archive/2025/09/05/Foo_ms_v3_AD.docx
archive/2025/08/24/Foo_ms_v3.docx
archive/2025/08/22/Foo_ms_v3.docx
archive/2025/08/20/Foo_ms_v3.docx
archive/2025/08/14/Foo_ms_v2_LAM.docx
archive/2025/08/10/Foo_ms_v2.docx
archive/2025/08/04/Foo_ms_v1.docx
I use find(1) with
-type f to show only regular files and avoid directories.
Then I use sort(1) in reverse
order to show the newest files at the top.
You can also filter for versions revised by a co-author. For example, look at versions revised by “LAM”:
$ find archive/ -type f | sort -r | grep "LAM"
archive/2025/09/05/Foo_ms_v3_LAM.docx
archive/2025/08/14/Foo_ms_v2_LAM.docx
I use the same command as before but pipe the output into grep(1) to filter those files that include the string “LAM” in their name.
If you want a prettier look, you can transform it into a table:
$ find archive/ -type f | sort -r | cut -d '/' -f 2- | column -s '/' -t
2025 09 26 Foo_ms_v5_AD.docx
2025 09 24 Foo_ms_v5.docx
2025 09 20 Foo_ms_v4.docx
2025 09 05 Foo_ms_v3_LAM.docx
2025 09 05 Foo_ms_v3_AD.docx
2025 08 24 Foo_ms_v3.docx
2025 08 22 Foo_ms_v3.docx
2025 08 20 Foo_ms_v3.docx
2025 08 14 Foo_ms_v2_LAM.docx
2025 08 10 Foo_ms_v2.docx
2025 08 04 Foo_ms_v1.docx
Here the output is first processed with cut(1), which splits the text by
some delimiter (in this case, the forward slash: -d '/'),
and then prints all the resulting fields except the first (specified
with the -f 2-). Then, column(1) transforms this into
a table using “/” as a separator (-s '/').
Finally, if you want a fancier table, you can use awk(1) to do more processing:
$ find archive/ -type f | sort -r | awk -F '/' 'BEGIN {print "DATE FILE"} {printf("%s-%s-%s %s\n", $2,$3,$4,$5)}' | column -t
DATE FILE
2025-09-26 Foo_ms_v5_AD.docx
2025-09-24 Foo_ms_v5.docx
2025-09-20 Foo_ms_v4.docx
2025-09-05 Foo_ms_v3_LAM.docx
2025-09-05 Foo_ms_v3_AD.docx
2025-08-24 Foo_ms_v3.docx
2025-08-22 Foo_ms_v3.docx
2025-08-20 Foo_ms_v3.docx
2025-08-14 Foo_ms_v2_LAM.docx
2025-08-10 Foo_ms_v2.docx
2025-08-04 Foo_ms_v1.docx
Here I only use awk to add a header and then format the
date as YEAR-MONTH-DAY. But at this point the command is just too long,
so you may want to put it into a script if you need something like
this.
This isn’t meant to replace Git. I use Git to manage the whole repository, which includes manuscripts, data, data analysis, figures, etc. This approach works at another level, helping you get a clean look at manuscript versions.
To back up the archive or just send it to yourself by email, you can compress it:
# with tar
tar -czf some_archive.tar.gz archive/
# with zip
zip -r some_archive.zip archive/
And that’s it!