blob: d2a844d19984ca11b7b8afb53f208fb0af11d5bc (
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
|
#!/usr/bin/env bash
# gosend : scp files to gopher server
# requires : pb https://git.wittamore.com/bashlib/tree
# usage : gosend hours (if not set default is 1 hour)
# example : gosend 72 sends files modified over the past 3 days
source ~/.local/bashlib/pb_number
source ~/.local/bashlib/pb_colour
# folders
rf=spike:/srv/gopher
mf=$HOME/src/gopher
cd $mf || exit
# test if $1
if [ -z "$1" ]; then
printf %b "$(pb_fg 196)no parameter, using 1$(pb_nc)\n"
hours=1;
else
# test if $1 is a number
if [ "$1" -eq "$1" ] >/dev/null 2>&1; then
hours="$1";
else
printf %b "$(pb_fg 196)bad parameter, using 1$(pb_nc)\n"
hours=1;
fi
fi
minutes=$((hours*60))
printf "Sending files modified in the past $hours hour(s) to $rf\n"
files=$(find -- * -iname "*.html" -path .tmp -prune -o -mmin -$minutes -type f)
for file in $files
do
printf %s "-> "; scp "$file" "$rf/$file";
done
printf "Done.\n"
exit 0
|