Managing event-related files in a folder hierarchy like "<ARCHIVE>/2013/2013-05-17 Event name/"
Python
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

README.org

m2a.py

This script moves items (files or directories) containing ISO datestamps like YYYY-MM-DD into a directory stucture for the corresponding year.

You define the base directory either in this script (or using the command line argument --archivedir). The convention is, e.g.:

<archivepath>/2011
<archivepath>/2011/2011-12-20 Meeting Friends at Barleys
<archivepath>/2011/2011-12-20 Meeting Friends at Barleys/Tom with Beer.jpeg

This script extracts the year from the datestamp of each file and moves it into the corresponding directory for its year:

m2a 2010-01-01_Jan2010.txt 2011-02-02_Feb2011.txt

… moves 2010-01-01_Jan2010.txt to <archivepath>/2010/ … moves 2011-02-02_Feb2011.txt to <archivepath>/2011/

OPTIONALLY: you can define a sub-directory name with option -d DIR. If it contains no datestamp by itself, a datestamp from the first file of the argument list will be used. This datestamp will be put in front of the name:

m2a  -d "2009-02-15 bar"  one two three

… moves all items to: <archivepath>/2009/2009-02-15 bar/

m2a  -d bar  2011-10-10_one 2008-01-02_two 2011-10-12_three

… moves all items to: <archivepath>/2011/2011-10-10 bar/

If you feel uncomfortable you can simulate the behavior using the --dryrun option. You see what would happen without changing anything at all.

For the complete usage help, please use the --help option.

  • Target group: users who are able to use command line tools and who are managing photographs and other event-related files in folder structures.
  • Hosted on github: https://github.com/novoid/move2archive

Why

There is no integrated software solution for managing photographs that will (a) provide you all of the features you will ever want, (b) be available for a long period of time, and (c) provide a future-prove, platform-independent work-flow.

This is the reason I came up with this method of organizing archive files (photographs, scanned PDF files, memories, …) in such a folder structure.

Installation

Get it from GitHub or install it via «pip install move2archive».

Bonus: integrating into Geeqie (or similar file browsers)

I am using geeqie for browsing/presenting image files. For quickly moving files to their folders, I mapped this script to m. This way, I can go through new image files and move event-related photographs very quickly.

Using GNU/Linux, this is quite easy accomplished. The only thing that is not straight forward is the need for a wrapper script. The wrapper script does provide a shell window for entering the tags.

vk-m2a-wrapper-with-gnome-terminal.sh looks like:

#!/bin/sh

:

/usr/bin/gnome-terminal \
    --geometry=157x56+330+5  \
    --hide-menubar \
    -x /home/vk/bin/m2a --pauseonexit "${@}"

:

#end

In $HOME/.config/geeqie/applications I wrote a desktop file such that geeqie shows the wrapper script as external editor to its image files:

$HOME/.config/geeqie/applications/m2a.desktop looks like:

[Desktop Entry]
Name=m2a
GenericName=m2a
Comment=
Exec=/home/vk/src/misc/vk-m2a-wrapper-with-gnome-terminal.sh %F
Icon=
Terminal=true
Type=Application
Categories=Application;Graphics;
hidden=false
MimeType=image/*;video/*;image/mpo;image/thm
Categories=X-Geeqie;

In order to be able to use the keyboard shortcuts m, you can define them in geeqie:

  1. Edit > Preferences > Preferences … > Keyboard.
  2. Scroll to the bottom of the list.
  3. Double click in the KEY-column of m2a and choose your desired keyboard shortcut accordingly.

I hope this method is as handy for you as it is for me :-)

Related tools and workflows

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 this blog posting you might like to read.

In short:

For tagging, please refer to filetags and its documentation.

See 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 appendfilename (once more) and filetags.

Moving to the archive folders is done using move2archive.

Having tagged photographs gives you many advantages. For example, I automatically choose my desktop background image according to the current season.

Files containing an ISO time/date-stamp gets indexed by the filename-module of Memacs.

Here is a 45 minute talk I gave at Linuxtage Graz 2018 presenting the idea of and workflows related to appendfilename and other handy tools for file management:

bin/2018-05-06 filetags demo slide for video preview with video button -- screenshots.png

How to Thank Me

I’m glad you like my tools. If you want to support me:

  • Send old-fashioned postcard per snailmail - I love personal feedback!
  • Send feature wishes or improvements as an issue on GitHub
  • Create issues on GitHub for bugs
  • Contribute merge requests for bug fixes
  • Check out my other cool projects on GitHub

Local Variables