]> gitweb @ CieloNegro.org - sugar.git/blob - tools/import.pl
Auto commit by The Sugar System.
[sugar.git] / tools / import.pl
1 use strict;
2 use warnings;
3 use Smart::Comments;
4 use lib 'tools';
5 require 'utils.pl';
6 use File::Spec;
7 use File::Copy;
8 use File::Path;
9
10 sub main {
11     while (defined(my $arg = <>)) {
12         chomp $arg;
13
14         my $rel   = File::Spec->abs2rel($arg, $ENV{HOME});
15         my $abs   = File::Spec->rel2abs($rel, $ENV{HOME});
16         my $saved = rel2saved($rel);
17
18         print "Copying $abs to $saved...\n";
19         my @path = File::Spec->splitdir($saved);
20         pop @path;
21         mkpath(File::Spec->catdir(@path));
22         copy($abs, $saved) or die $!;
23     }
24 }
25
26 main();