m2a 2026.3.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,267 @@
1
+ Metadata-Version: 2.4
2
+ Name: m2a
3
+ Version: 2026.3.1.1
4
+ Summary: This script moves items (files or directories) containing ISO datestamps like YYYY-MM-DD into a directory stucture for the corresponding year.
5
+ Home-page: https://github.com/novoid/move2archive
6
+ Download-URL: https://github.com/novoid/move2archive/zipball/master
7
+ Author: Karl Voit
8
+ Author-email: Karl Voit <tools@Karl-Voit.at>
9
+ License-Expression: GPL-3.0-or-later
10
+ Project-URL: Homepage, https://github.com/novoid/move2archive
11
+ Keywords: file mangement,filetags,PIM
12
+ Classifier: Programming Language :: Python :: 3 :: Only
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: End Users/Desktop
16
+ Classifier: Operating System :: OS Independent
17
+ Requires-Python: >=3.13
18
+ Description-Content-Type: text/plain
19
+ Requires-Dist: pyreadline3>=3.5.4
20
+ Dynamic: author
21
+ Dynamic: download-url
22
+ Dynamic: home-page
23
+
24
+ * m2a.py
25
+
26
+ This script moves items (files or directories) containing ISO datestamps
27
+ like ~YYYY-MM-DD~ into a directory stucture for the corresponding year.
28
+
29
+ You define the base directory either in this script (or using the
30
+ command line argument ~--archivedir~). The convention is, e.g.:
31
+
32
+ #+begin_src bash
33
+ <archivepath>/2011
34
+ <archivepath>/2011/2011-12-20 Meeting Friends at Barleys
35
+ <archivepath>/2011/2011-12-20 Meeting Friends at Barleys/Tom with Beer.jpeg
36
+ #+end_src
37
+
38
+ This script extracts the year from the datestamp of each file and
39
+ moves it into the corresponding directory for its year:
40
+
41
+ #+begin_src bash
42
+ m2a 2010-01-01_Jan2010.txt 2011-02-02_Feb2011.txt
43
+ #+end_src
44
+ ... moves ~2010-01-01_Jan2010.txt~ to ~<archivepath>/2010/~
45
+ ... moves ~2011-02-02_Feb2011.txt~ to ~<archivepath>/2011/~
46
+
47
+ OPTIONALLY: you can define a sub-directory name with option ~-d DIR~. If it
48
+ contains no datestamp by itself, a datestamp from the first file of the
49
+ argument list will be used. This datestamp will be put in front of the name:
50
+
51
+ #+begin_src bash
52
+ m2a -d "2009-02-15 bar" one two three
53
+ #+end_src
54
+ ... moves all items to: ~<archivepath>/2009/2009-02-15 bar/~
55
+
56
+ #+begin_src bash
57
+ m2a -d bar 2011-10-10_one 2008-01-02_two 2011-10-12_three
58
+ #+end_src
59
+ ... moves all items to: ~<archivepath>/2011/2011-10-10 bar/~
60
+
61
+ If you feel uncomfortable you can simulate the behavior using the ~--dryrun~
62
+ option. You see what would happen without changing anything at all.
63
+
64
+ For the complete usage help, please use the ~--help~ option.
65
+
66
+
67
+ - *Target group*: users who are able to use command line tools and who
68
+ are managing photographs and other event-related files in folder
69
+ structures.
70
+ - Hosted on github: https://github.com/novoid/move2archive
71
+
72
+ ** Why
73
+
74
+ There is no integrated software solution for managing photographs
75
+ that will (a) provide you all of the features you will ever want, (b)
76
+ be available for a long period of time, and (c) provide a
77
+ future-prove, platform-independent work-flow.
78
+
79
+ This is the reason I came up with this method of organizing archive
80
+ files (photographs, scanned PDF files, memories, ...) in such a
81
+ folder structure.
82
+
83
+ ** Installation
84
+
85
+ Get it from [[https://github.com/novoid/move2archive][GitHub]] or install it via «pip install move2archive».
86
+
87
+ ** Interactive Use
88
+ :PROPERTIES:
89
+ :CREATED: [2022-01-06 Thu 11:34]
90
+ :END:
91
+
92
+ If you are using =m2a= in an interactive way, you need to know the
93
+ following behavior difference when you (1) provide a target directory
94
+ and (2) when no specific target directory is provided by you.
95
+
96
+ Let's use two example files:
97
+ - =2020-07-13T13.55 xkcd about PIM.png=
98
+ - =2022-01-06 screenshot of my editor.png=
99
+
100
+ Now let's assume those two files are the only PNG files in the current
101
+ directory and the following command line you're using: =m2a *png=
102
+
103
+ First, let's take a look at the version (1) where you select or enter
104
+ a target directory to file to.
105
+
106
+ *** Selecting a Target Directory
107
+
108
+ When asked "Please enter directory basename:" in the interactive
109
+ prompt you're entering "some images".
110
+
111
+ This will result in *both* files moved to the one target directory
112
+ where the oldest date-stamp is used to determine the year:
113
+
114
+ - =<archivepath>/2020/2020-07-13 some images/2020-07-13T13.55 xkcd about PIM.png=.
115
+ - =<archivepath>/2020/2020-07-13 some images/2022-01-06 screenshot of my editor.png=.
116
+
117
+ This is because the files are grouped together to be filed to the same
118
+ spot when one single target directory is given.
119
+
120
+ A handy feature of =m2a= is that it suggest existing folders in the
121
+ =archivepath=. So if you already do have a folder like
122
+ =<archivepath>/2020/2020-07-13 interesting stuff/= and you call =m2a=
123
+ with any file that starts with =2020-07-13...=, it shows a prompt
124
+ like:
125
+
126
+ : One matching target directory found. Enter "1" if you want to use it:
127
+ : [1] 2020-07-13 interesting stuff
128
+
129
+ In the case you want to re-use this directory as the target directory
130
+ for the current files , you simply enter =1= to the prompt and the
131
+ files are moved to that directory. Isn't that handy?
132
+
133
+ Now, let's compare with (2) when no target directory is given in the
134
+ next section.
135
+
136
+ *** Not Selecting a Target Directory
137
+
138
+ This time, you do not enter anything in the target directory prompt
139
+ and you do not select a proposed target by entering a numeric
140
+ shortcut.
141
+
142
+ This will result in each file moved to its corresponding yearly archive directory:
143
+
144
+ - =<archivepath>/2020/2020-07-13T13.55 xkcd about PIM.png=
145
+ - =<archivepath>/2022/2022-01-06 screenshot of my editor.png=
146
+
147
+ *** On the Difference of Behavior
148
+
149
+ The reasoning behind this different behavior between a specific target
150
+ directory is provided and not is that you can use =m2a= to file away a
151
+ larger group of files to their yearly archive folders without the need
152
+ of filing each one individually or writing a loop command.
153
+
154
+ However, when you do provide one single target directory, this is used
155
+ for all files, independent of their date-stamp (using the oldest
156
+ date-stamp).
157
+
158
+ This might irritate at first but makes perfectly sense if you think
159
+ about it or the alternatives.
160
+
161
+ ** Bonus: integrating into Geeqie (or similar file browsers)
162
+
163
+ I am using [[http://geeqie.sourceforge.net/][geeqie]] for browsing/presenting image files. For quickly
164
+ moving files to their folders, I mapped this script to ~m~. This way,
165
+ I can go through new image files and move event-related photographs
166
+ very quickly.
167
+
168
+ Using GNU/Linux, this is quite easy accomplished. The only thing that
169
+ is not straight forward is the need for a wrapper script. The wrapper
170
+ script does provide a shell window for entering the tags.
171
+
172
+ ~vk-m2a-wrapper-with-gnome-terminal.sh~ looks like:
173
+ #+begin_src bash
174
+ #!/bin/sh
175
+
176
+ /usr/bin/gnome-terminal \
177
+ --geometry=157x56+330+5 \
178
+ --hide-menubar \
179
+ -x /home/vk/bin/m2a --pauseonexit "${@}"
180
+
181
+ #end
182
+ #+end_src
183
+
184
+ In ~$HOME/.config/geeqie/applications~ I wrote a desktop file such
185
+ that geeqie shows the wrapper script as external editor to its
186
+ image files:
187
+
188
+ ~$HOME/.config/geeqie/applications/m2a.desktop~ looks like:
189
+ #+begin_src bash
190
+ [Desktop Entry]
191
+ Name=m2a
192
+ GenericName=m2a
193
+ Comment=
194
+ Exec=/home/vk/src/misc/vk-m2a-wrapper-with-gnome-terminal.sh %F
195
+ Icon=
196
+ Terminal=true
197
+ Type=Application
198
+ Categories=Application;Graphics;
199
+ hidden=false
200
+ MimeType=image/*;video/*;image/mpo;image/thm
201
+ Categories=X-Geeqie;
202
+ #+end_src
203
+
204
+ In order to be able to use the keyboard shortcuts ~m~, you can define
205
+ them in geeqie:
206
+ 1. Edit > Preferences > Preferences ... > Keyboard.
207
+ 2. Scroll to the bottom of the list.
208
+ 3. Double click in the ~KEY~-column of ~m2a~ and choose
209
+ your desired keyboard shortcut accordingly.
210
+
211
+ I hope this method is as handy for you as it is for me :-)
212
+
213
+ * Related tools and workflows
214
+
215
+ This tool is part of a tool-set which I use to manage my digital files
216
+ such as photographs. My work-flows are described in [[http://karl-voit.at/managing-digital-photographs/][this blog posting]]
217
+ you might like to read.
218
+
219
+ In short:
220
+
221
+ For *tagging*, please refer to [[https://github.com/novoid/filetags][filetags]] and its documentation.
222
+
223
+ See [[https://github.com/novoid/date2name][date2name]] for easily adding ISO *time-stamps or date-stamps* to
224
+ files.
225
+
226
+ For *easily naming and tagging* files within file browsers that allow
227
+ integration of external tools, see [[https://github.com/novoid/appendfilename][appendfilename]] (once more) and
228
+ [[https://github.com/novoid/filetags][filetags]].
229
+
230
+ Moving to the archive folders is done using [[https://github.com/novoid/move2archive][move2archive]].
231
+
232
+ Having tagged photographs gives you many advantages. For example, I
233
+ automatically [[https://github.com/novoid/set_desktop_background_according_to_season][choose my *desktop background image* according to the
234
+ current season]].
235
+
236
+ Files containing an ISO time/date-stamp gets indexed by the
237
+ filename-module of [[https://github.com/novoid/Memacs][Memacs]].
238
+
239
+ 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
240
+ idea of and workflows related to appendfilename and other handy tools
241
+ for file management:
242
+
243
+ [[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]]
244
+
245
+ Other projects with similar features:
246
+
247
+ - https://github.com/velvet-jones/imgfiler/
248
+
249
+ * How to Thank Me
250
+
251
+ I'm glad you like my tools. If you want to support me:
252
+
253
+ - Send old-fashioned *postcard* per snailmail - I love personal feedback!
254
+ - see [[http://tinyurl.com/j6w8hyo][my address]]
255
+ - Send feature wishes or improvements as an issue on GitHub
256
+ - Create issues on GitHub for bugs
257
+ - Contribute merge requests for bug fixes
258
+ - Check out my other cool [[https://github.com/novoid][projects on GitHub]]
259
+
260
+
261
+
262
+ * Local Variables :noexport:
263
+ # Local Variables:
264
+ # mode: auto-fill
265
+ # mode: flyspell
266
+ # eval: (ispell-change-dictionary "en_US")
267
+ # End:
@@ -0,0 +1,244 @@
1
+ * m2a.py
2
+
3
+ This script moves items (files or directories) containing ISO datestamps
4
+ like ~YYYY-MM-DD~ into a directory stucture for the corresponding year.
5
+
6
+ You define the base directory either in this script (or using the
7
+ command line argument ~--archivedir~). The convention is, e.g.:
8
+
9
+ #+begin_src bash
10
+ <archivepath>/2011
11
+ <archivepath>/2011/2011-12-20 Meeting Friends at Barleys
12
+ <archivepath>/2011/2011-12-20 Meeting Friends at Barleys/Tom with Beer.jpeg
13
+ #+end_src
14
+
15
+ This script extracts the year from the datestamp of each file and
16
+ moves it into the corresponding directory for its year:
17
+
18
+ #+begin_src bash
19
+ m2a 2010-01-01_Jan2010.txt 2011-02-02_Feb2011.txt
20
+ #+end_src
21
+ ... moves ~2010-01-01_Jan2010.txt~ to ~<archivepath>/2010/~
22
+ ... moves ~2011-02-02_Feb2011.txt~ to ~<archivepath>/2011/~
23
+
24
+ OPTIONALLY: you can define a sub-directory name with option ~-d DIR~. If it
25
+ contains no datestamp by itself, a datestamp from the first file of the
26
+ argument list will be used. This datestamp will be put in front of the name:
27
+
28
+ #+begin_src bash
29
+ m2a -d "2009-02-15 bar" one two three
30
+ #+end_src
31
+ ... moves all items to: ~<archivepath>/2009/2009-02-15 bar/~
32
+
33
+ #+begin_src bash
34
+ m2a -d bar 2011-10-10_one 2008-01-02_two 2011-10-12_three
35
+ #+end_src
36
+ ... moves all items to: ~<archivepath>/2011/2011-10-10 bar/~
37
+
38
+ If you feel uncomfortable you can simulate the behavior using the ~--dryrun~
39
+ option. You see what would happen without changing anything at all.
40
+
41
+ For the complete usage help, please use the ~--help~ option.
42
+
43
+
44
+ - *Target group*: users who are able to use command line tools and who
45
+ are managing photographs and other event-related files in folder
46
+ structures.
47
+ - Hosted on github: https://github.com/novoid/move2archive
48
+
49
+ ** Why
50
+
51
+ There is no integrated software solution for managing photographs
52
+ that will (a) provide you all of the features you will ever want, (b)
53
+ be available for a long period of time, and (c) provide a
54
+ future-prove, platform-independent work-flow.
55
+
56
+ This is the reason I came up with this method of organizing archive
57
+ files (photographs, scanned PDF files, memories, ...) in such a
58
+ folder structure.
59
+
60
+ ** Installation
61
+
62
+ Get it from [[https://github.com/novoid/move2archive][GitHub]] or install it via «pip install move2archive».
63
+
64
+ ** Interactive Use
65
+ :PROPERTIES:
66
+ :CREATED: [2022-01-06 Thu 11:34]
67
+ :END:
68
+
69
+ If you are using =m2a= in an interactive way, you need to know the
70
+ following behavior difference when you (1) provide a target directory
71
+ and (2) when no specific target directory is provided by you.
72
+
73
+ Let's use two example files:
74
+ - =2020-07-13T13.55 xkcd about PIM.png=
75
+ - =2022-01-06 screenshot of my editor.png=
76
+
77
+ Now let's assume those two files are the only PNG files in the current
78
+ directory and the following command line you're using: =m2a *png=
79
+
80
+ First, let's take a look at the version (1) where you select or enter
81
+ a target directory to file to.
82
+
83
+ *** Selecting a Target Directory
84
+
85
+ When asked "Please enter directory basename:" in the interactive
86
+ prompt you're entering "some images".
87
+
88
+ This will result in *both* files moved to the one target directory
89
+ where the oldest date-stamp is used to determine the year:
90
+
91
+ - =<archivepath>/2020/2020-07-13 some images/2020-07-13T13.55 xkcd about PIM.png=.
92
+ - =<archivepath>/2020/2020-07-13 some images/2022-01-06 screenshot of my editor.png=.
93
+
94
+ This is because the files are grouped together to be filed to the same
95
+ spot when one single target directory is given.
96
+
97
+ A handy feature of =m2a= is that it suggest existing folders in the
98
+ =archivepath=. So if you already do have a folder like
99
+ =<archivepath>/2020/2020-07-13 interesting stuff/= and you call =m2a=
100
+ with any file that starts with =2020-07-13...=, it shows a prompt
101
+ like:
102
+
103
+ : One matching target directory found. Enter "1" if you want to use it:
104
+ : [1] 2020-07-13 interesting stuff
105
+
106
+ In the case you want to re-use this directory as the target directory
107
+ for the current files , you simply enter =1= to the prompt and the
108
+ files are moved to that directory. Isn't that handy?
109
+
110
+ Now, let's compare with (2) when no target directory is given in the
111
+ next section.
112
+
113
+ *** Not Selecting a Target Directory
114
+
115
+ This time, you do not enter anything in the target directory prompt
116
+ and you do not select a proposed target by entering a numeric
117
+ shortcut.
118
+
119
+ This will result in each file moved to its corresponding yearly archive directory:
120
+
121
+ - =<archivepath>/2020/2020-07-13T13.55 xkcd about PIM.png=
122
+ - =<archivepath>/2022/2022-01-06 screenshot of my editor.png=
123
+
124
+ *** On the Difference of Behavior
125
+
126
+ The reasoning behind this different behavior between a specific target
127
+ directory is provided and not is that you can use =m2a= to file away a
128
+ larger group of files to their yearly archive folders without the need
129
+ of filing each one individually or writing a loop command.
130
+
131
+ However, when you do provide one single target directory, this is used
132
+ for all files, independent of their date-stamp (using the oldest
133
+ date-stamp).
134
+
135
+ This might irritate at first but makes perfectly sense if you think
136
+ about it or the alternatives.
137
+
138
+ ** Bonus: integrating into Geeqie (or similar file browsers)
139
+
140
+ I am using [[http://geeqie.sourceforge.net/][geeqie]] for browsing/presenting image files. For quickly
141
+ moving files to their folders, I mapped this script to ~m~. This way,
142
+ I can go through new image files and move event-related photographs
143
+ very quickly.
144
+
145
+ Using GNU/Linux, this is quite easy accomplished. The only thing that
146
+ is not straight forward is the need for a wrapper script. The wrapper
147
+ script does provide a shell window for entering the tags.
148
+
149
+ ~vk-m2a-wrapper-with-gnome-terminal.sh~ looks like:
150
+ #+begin_src bash
151
+ #!/bin/sh
152
+
153
+ /usr/bin/gnome-terminal \
154
+ --geometry=157x56+330+5 \
155
+ --hide-menubar \
156
+ -x /home/vk/bin/m2a --pauseonexit "${@}"
157
+
158
+ #end
159
+ #+end_src
160
+
161
+ In ~$HOME/.config/geeqie/applications~ I wrote a desktop file such
162
+ that geeqie shows the wrapper script as external editor to its
163
+ image files:
164
+
165
+ ~$HOME/.config/geeqie/applications/m2a.desktop~ looks like:
166
+ #+begin_src bash
167
+ [Desktop Entry]
168
+ Name=m2a
169
+ GenericName=m2a
170
+ Comment=
171
+ Exec=/home/vk/src/misc/vk-m2a-wrapper-with-gnome-terminal.sh %F
172
+ Icon=
173
+ Terminal=true
174
+ Type=Application
175
+ Categories=Application;Graphics;
176
+ hidden=false
177
+ MimeType=image/*;video/*;image/mpo;image/thm
178
+ Categories=X-Geeqie;
179
+ #+end_src
180
+
181
+ In order to be able to use the keyboard shortcuts ~m~, you can define
182
+ them in geeqie:
183
+ 1. Edit > Preferences > Preferences ... > Keyboard.
184
+ 2. Scroll to the bottom of the list.
185
+ 3. Double click in the ~KEY~-column of ~m2a~ and choose
186
+ your desired keyboard shortcut accordingly.
187
+
188
+ I hope this method is as handy for you as it is for me :-)
189
+
190
+ * Related tools and workflows
191
+
192
+ This tool is part of a tool-set which I use to manage my digital files
193
+ such as photographs. My work-flows are described in [[http://karl-voit.at/managing-digital-photographs/][this blog posting]]
194
+ you might like to read.
195
+
196
+ In short:
197
+
198
+ For *tagging*, please refer to [[https://github.com/novoid/filetags][filetags]] and its documentation.
199
+
200
+ See [[https://github.com/novoid/date2name][date2name]] for easily adding ISO *time-stamps or date-stamps* to
201
+ files.
202
+
203
+ For *easily naming and tagging* files within file browsers that allow
204
+ integration of external tools, see [[https://github.com/novoid/appendfilename][appendfilename]] (once more) and
205
+ [[https://github.com/novoid/filetags][filetags]].
206
+
207
+ Moving to the archive folders is done using [[https://github.com/novoid/move2archive][move2archive]].
208
+
209
+ Having tagged photographs gives you many advantages. For example, I
210
+ automatically [[https://github.com/novoid/set_desktop_background_according_to_season][choose my *desktop background image* according to the
211
+ current season]].
212
+
213
+ Files containing an ISO time/date-stamp gets indexed by the
214
+ filename-module of [[https://github.com/novoid/Memacs][Memacs]].
215
+
216
+ 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
217
+ idea of and workflows related to appendfilename and other handy tools
218
+ for file management:
219
+
220
+ [[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]]
221
+
222
+ Other projects with similar features:
223
+
224
+ - https://github.com/velvet-jones/imgfiler/
225
+
226
+ * How to Thank Me
227
+
228
+ I'm glad you like my tools. If you want to support me:
229
+
230
+ - Send old-fashioned *postcard* per snailmail - I love personal feedback!
231
+ - see [[http://tinyurl.com/j6w8hyo][my address]]
232
+ - Send feature wishes or improvements as an issue on GitHub
233
+ - Create issues on GitHub for bugs
234
+ - Contribute merge requests for bug fixes
235
+ - Check out my other cool [[https://github.com/novoid][projects on GitHub]]
236
+
237
+
238
+
239
+ * Local Variables :noexport:
240
+ # Local Variables:
241
+ # mode: auto-fill
242
+ # mode: flyspell
243
+ # eval: (ispell-change-dictionary "en_US")
244
+ # End: