summaryrefslogtreecommitdiff
path: root/readme.txt
blob: 0e3223d22cd07a70541843b8daaf21a55bbd9a41 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
automv.sh
=========

Usage:
  ./automv.sh

Prereqs:
  Requires bash with the following utilities:
    grep
    xargs
    find
    mktemp
    csplit

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/

example multi query conf
========================

# picturemv.conf
# jpeg/jpg
query.*\.jp[e]?g$
source/home/user/Downloads/
target=/home/user/Pictures/
---
query=.*\.png$
source=/home/user/Downloads/
target=/home/user/Pictures/
---
query=.*\.webp
source=/home/user/Downloads/
target=/dev/null

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?
[x] Multiple queries per file? What if you have diverging regexes? does find support ORs?