Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl -w
- $dest = "/home/nattack/One Piece/";
- $source = "/home/nattack/Dropbox/SHARIN\\ WITH\\ NATTEH/One\\ Piece/";
- #counts processed files
- $filecount = 0;
- #glob is annoying and wants things to be like shell
- #except everything else works like perl,
- #so i need to change the source variable just to get this POS to work
- foreach $file ( glob $source . "*" ) {
- $file =~ s/.*\/(.*)/$1/;
- $source =~ s/\\//g;
- unless ( -e ($dest . $file) ) {
- print "Error linking file $file: $!\n" unless link "$source$file", "$dest$file";
- $filecount++; #why does this work? is perl reading my mind?
- } else {
- print "File exists: $file\n";
- }
- }
- print "$filecount files processed.\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement