-
-
Save dcecile/9d0943e823daeaeb6371a61fa939cca2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env perl | |
| use strict; | |
| use warnings; | |
| use File::Copy qw(mv); | |
| use Data::Dumper qw(Dumper); | |
| die if @ARGV < 2; | |
| my $destination = $ARGV[@ARGV - 1]; | |
| #my $isRename = ; | |
| if (@ARGV == 2 and not -d $destination) { | |
| my $source = $ARGV[0]; | |
| mv $source, $destination; | |
| symlink $destination, $source; | |
| } | |
| else { | |
| my $directory = $destination; | |
| my @files = @ARGV[0 .. @ARGV - 2]; | |
| for (@files) { | |
| my $from = $_; | |
| my $to = "$directory$_"; | |
| #print "From $from\n"; | |
| #print " to $to\n"; | |
| mv $from, $to; | |
| symlink $to, $from; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment