home *** CD-ROM | disk | FTP | other *** search
/ Acorn User 10 / AU_CD10.iso / Updates / Perl / Non-RPC / !Perl / scripts / release < prev    next >
Text File  |  1998-08-01  |  859b  |  50 lines

  1. #! perl -w
  2. use RISCOS;
  3. use RISCOS::File 'copy';
  4.  
  5. if ($ARGV[0] eq '-q') {
  6.     $quiet = 1;
  7.     shift;
  8. } else { $quiet = 0 }
  9.  
  10. die "$0 [-q] <From> <To>" if( $#ARGV < 1 );
  11.  
  12. $sourcedir = shift;
  13. $destdir = shift;
  14.  
  15.  
  16. sub get_dir
  17. {
  18.     local ($from, $to) = @_;
  19.     local ($file, $len);
  20.  
  21.     $len = 1 + length $to;
  22.  
  23.     foreach $file (glob ("$to.*"))
  24.     {
  25.     $file = substr ($file,$len);
  26.     #print "$to.$file\n";
  27.     if (-d "$to.$file")
  28.     {
  29.         print "Recursing to $to.$file\n" unless $quiet;
  30.         get_dir ("$from.$file", "$to.$file");
  31.     }
  32.     else
  33.     {
  34.         if (-f ("$from.$file"))
  35.         {
  36.         if (-M (_) != -M ("$to.$file"))
  37.         {
  38.             #print("copy $from.$file $to.$file ~cvnf\n");
  39.             copy "$from.$file", "$to.$file", 0x1112 or print STDERR "$!\n";
  40.         }
  41.         }
  42.         else {
  43.         warn ("'$from.$file' does not exist.\n") unless $quiet;
  44.         }
  45.     }
  46.     }
  47. }
  48.  
  49. get_dir ($sourcedir, $destdir);
  50.