forked from entorb/strava
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sicher.pl
67 lines (46 loc) · 1.88 KB
/
sicher.pl
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
#!/usr/bin/perl -w
# by Torben Menke https://entorb.net
# DESCRIPTION
# TODO
# IDEAS
# DONE
# Modules: My Default Set
use strict;
use warnings;
use 5.010; # say
use Data::Dumper;
use utf8; # this script is written in UTF-8
binmode STDOUT, ':utf8'; # default encoding for linux print STDOUT
# Modules: Perl Standard
use Encode qw(encode decode);
# use File::Path qw/remove_tree/;
# use Time::Local;
# use Storable; # read and write variables to
@_ = localtime time;
# ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime (time);
my $datestr = sprintf "%02d%02d%02d-%02d%02d%02d", $_[ 5 ] + 1900 - 2000, $_[ 4 ] + 1, $_[ 3 ], $_[ 2 ], $_[ 1 ], $_[ 0 ];
my $outfile = "/home/entorb/sicher/strava/$datestr.zip";
say $outfile;
my @listOfFiles;
push @listOfFiles, grep {-f} <*>; # files only
push @listOfFiles, <screenshots/*>;
push @listOfFiles, <download/*.xlsx>;
push @listOfFiles, <gnuplot/*.gp>;
push @listOfFiles, '/home/entorb/data-web-pages/strava/city-gps.dat';
# print Dumper @listOfFiles;
zipFiles( $outfile, @listOfFiles );
sub zipFiles {
# Zipping of activityJSONs
# in: $pathToZip, @files , both in absolute path
# out: nothing
my ( $pathToZip, @files ) = @_;
use IO::Compress::Zip qw(zip $ZipError);
zip \@files => $pathToZip,
TextFlag => 1 # It is used to signal that the data stored in the zip file/buffer is probably text.
, CanonicalName => 1 # This option controls whether the filename field in the zip header is normalized into Unix format before being written to the zip file.
, ZipComment => "Created by Torben's Stava App https://entorb.net/strava"
# , Level => 9 # [0..9], 0=none, 9=best compression
or die "zip failed: $ZipError\n";
return;
} ## end sub zipFiles
# FilterName => sub {s<.*[/\\]><>} # trim path, filename only