blob: fa0cd78b35ac0232e2953ff784bb63fe34473d72 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
automv.sh
=========
Usage:
./automv.sh
Prereqs:
Requires bash with the tools:
grep
xargs
find
Setup:
the script searches the directory:
/usr/local/etc/automv.d/
for any .conf files
Overriding the automv.d location:
If you want to set a different automv.d location setup the:
AUTOMV_DIR
environment variable
How it works:
it basically automates the finding of non-hidden files in the source dir
and will move them to an existing directory
automv.d/ conf syntax
=====================
The conf files use the following syntax:
# comments
query=<query>
this is the query you want to use in 'find -regex'
source=<source-dir>
this is the directory you want to search in
target=<target-dir>
this is the target directory to move the found files to
We explicitly parse out those 3 properties (see extract function in script)
!!! Note - do not quote wrap anything - the script expects unwrapped values
example conf
============
# jpegmv.conf
# moves jpeg files downloaded to pictures
query=.*\.jp[e]?g
source=/home/user/Downloads/
target=/home/user/Pictures/
Nice to haves / Tasks to be done
================================
[x] Better logging of moves - we repeat the find like 3 times to be
[ ] Timestamps in logs?
[ ] More flexibility / configurability
[ ] Fault tolerance
[ ] Auto mkdir -p if the target dir doesn't exist?
[ ] Multiple queries per file? What if you have diverging regexes? does find support ORs?
|