Handling time-stamps and date-stamps in file names
[[file:bin/screencast.gif]]
Per default, date2name gets the modification time of matching files
and directories and adds a datestamp in standard ISO 8601+ format
YYYY-MM-DD (http://datestamps.org/index.shtml) at the beginning of
the file- or directoryname.
If an existing timestamp is found, its style will be converted to the
selected ISO datestamp format but the numbers stays the same.
Executed with an examplefilename “file” this results e.g. in
“2008-12-31_file”.
Note: Other that defined in ISO 8601+ the delimiter between hours,
minutes, and seconds is not a colon but a dot. Colons are causing
several problems on different file systems and are there fore replaced
with the (older) DIN 5008 version with dots.
date2name [options] file ...
not modify files or directories
First, you need the programming platform [[https://www.python.org/downloads/][Python]] installed.
Then, you can
[[https://0dependencies.dev/0dependencies.svg]] → [[https://0dependencies.dev/][learn more about 0dependencies]]
** Integration into Windows File Explorer
The easiest way to integrate =date2name= into File Explorer (“Send to”
context menu) is by using [[https://github.com/novoid/integratethis][integratethis]].
*** Manual Integration into Windows Explorer for single files
Use this only if the [[https://github.com/novoid/integratethis][integratethis]] method can not be applied:
Create a registry file =add_date2name_to_context_menu.reg= and edit it
to meet the following template. Please make sure to replace the paths
(python, =USERNAME= and =date2name.py=) accordingly:
#+BEGIN_EXAMPLE
Windows Registry Editor Version 5.00
;; for files:
[HKEY_CLASSES_ROOT*\shell\date2name]
@=“date2name (single file)”
[HKEY_CLASSES_ROOT*\shell\date2name\command]
@="C:\Python36\python.exe C:\Users\USERNAME\src\date2name\date2name.py -i “%1"”
#+END_EXAMPLE
Execute the reg-file, confirm the warnings (you are modifying your
Windows registry after all) and cheer up when you notice “date2name
(single file)” in the context menu of your Windows Explorer.
As the heading and the link name suggests: [[https://stackoverflow.com/questions/6440715/how-to-pass-multiple-filenames-to-a-context-menu-shell-command][this method works on single
files]]. So if you select three files and invoke this context menu item,
you will get three different filetag-windows to tag one file each.
** Integration into Thunar
[[https://en.wikipedia.org/wiki/Thunar][Thunar]] is a popular GNU/Linux file browser for the xfce environment.
Unfortunately, it is rather complicated to add custom commands to
Thunar. I found [[https://askubuntu.com/questions/403922/keyboard-shortcut-for-thunar-custom-actions][a good description]] which you might want to follow.
To my disappoinment, even this manual confguration is not stable
somehow. From time to time, the IDs of $HOME/.config/Thunar/uca.xml
and $HOME/.config/Thunar/accels.scm differ.
For people using Org-mode, I automated the updating process (not the
initial adding process) to match IDs again:
egrep -A 2 "<name>$myname" $HOME/.config/Thunar/uca.xml | grep unique-id | sed 's#.*<unique-id>##' | sed 's#<.*$##'
grep -i "$ID" $HOME/.config/Thunar/accels.scm
egrep -A 2 "<name>$myname" $HOME/.config/Thunar/uca.xml | grep unique-id | sed 's#.*<unique-id>##' | sed 's#<.*$##'
** Integration into FreeCommander
[[http://freecommander.com/en/summary/][FreeCommander]] is a [[https://en.wikipedia.org/wiki/File_manager#Orthodox_file_managers][orthodox file manager]] for Windows. You can add
date2name as an favorite command:
So far, we’ve got =date2name= added as a favorite command which can be
accessed via menu or icon toolbar and the selected keyboard shortcut.
If you want to assign a different keyboard shortcut than =Ctrl-1= like
=Alt-d= you might as well follow following procedure:
Alternative implementations of date2name:
This tool is part of a tool-set which I use to manage my digital files
such as photographs. My work-flows are described in [[http://karl-voit.at/managing-digital-photographs/][this blog posting]]
you might like to read.
In short:
For tagging, please refer to [[https://github.com/novoid/filetags][filetags]] and its documentation.
See [[https://github.com/novoid/date2name][date2name]] for easily adding ISO time-stamps or date-stamps to
files.
For easily naming and tagging files within file browsers that allow
integration of external tools, see [[https://github.com/novoid/appendfilename][appendfilename]] (once more) and
[[https://github.com/novoid/filetags][filetags]].
Moving to the archive folders is done using [[https://github.com/novoid/move2archive][move2archive]].
Having tagged photographs gives you many advantages. For example, I
automatically [[https://github.com/novoid/set_desktop_background_according_to_season][choose my desktop background image according to the
current season]].
Files containing an ISO time/date-stamp gets indexed by the
filename-module of [[https://github.com/novoid/Memacs][Memacs]].
Here is [[https://glt18-programm.linuxtage.at/events/321.html][a 45 minute talk I gave]] at [[https://glt18.linuxtage.at/][Linuxtage Graz 2018]] presenting the
idea of and workflows related to appendfilename and other handy tools
for file management:
[[https://media.ccc.de/v/GLT18_-321-en-g_ap147_004-201804281550-the_advantages_of_file_name_conventions_and_tagging-_karl_voit/][bin/2018-05-06 filetags demo slide for video preview with video button – screenshots.png]]
I’m glad you like my tools. If you want to support me: