Advertisement
Nattack

onepiece cron

May 17th, 2012
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.72 KB | None | 0 0
  1. #!/usr/bin/perl -w
  2.  
  3. $dest = "/home/nattack/One Piece/";
  4. $source = "/home/nattack/Dropbox/SHARIN\\ WITH\\ NATTEH/One\\ Piece/";
  5.  
  6. #counts processed files
  7. $filecount = 0;
  8.  
  9. #glob is annoying and wants things to be like shell
  10. #except everything else works like perl,
  11. #so i need to change the source variable just to get this POS to work
  12. foreach $file ( glob $source . "*" ) {
  13.     $file =~ s/.*\/(.*)/$1/;
  14.     $source =~ s/\\//g;
  15.     unless ( -e ($dest . $file) ) {
  16.         print "Error linking file $file: $!\n" unless link "$source$file", "$dest$file";
  17.         $filecount++; #why does this work? is perl reading my mind?
  18.     } else {
  19.         print "File exists: $file\n";
  20.     }
  21. }
  22. print "$filecount files processed.\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement