use strict; use warnings; use Smart::Comments; use lib 'tools'; require 'utils.pl'; use File::Spec; use File::Copy; use File::Path; sub main { my @args = @_; foreach my $arg (@args) { my $rel = File::Spec->abs2rel($arg, $ENV{HOME}); my $abs = File::Spec->rel2abs($rel, $ENV{HOME}); my $saved = rel2saved($rel); print "Copying $abs to $saved...\n"; my @path = File::Spec->splitdir($saved); pop @path; mkpath(File::Spec->catdir(@path)); copy($abs, $saved) or die $!; } } main(@ARGV);