"Jimmy S. Lim" wrote:
> 
> hi perl friends,
> 
> i am trying to write a script to do a daily backup on files which have been
> modified on the same day the script is ran. i am just writing the beginning
> part of the script and i already got stuck. i kept getting the error: "
> Can't stat d:/perluser, no such file or directory". but i do have such a
> file and a directory!
> 
> What am i missing? Thanks in Advance for any help!!
> 
> jim
> 
> Here's the script :
> 
> use File::Find;
> use File::Copy;
> 
> my %Extension = (
>  dwg => '1',
>  xls => '1',
>  bp2 => '1',
>  doc => '1',
>  plx => '1',
>  html => '1',
>  );
> 
> while (<DATA>) {
>  my $path = 'd:/'."$_";
>  find(\&wanted, $path);
> }
> 
> sub wanted(
>  return unless !/(key %Extension)$/e;    #is it possible to have an
> expression inside the RegEx?
>  @File = grep (-M "$File::Find::name" <= 0, $dir);
>  print '@File = ' , "@File\n";
>   )
> 
> __DATA__
> Perluser
> Perluser-old

use strict;
use File::Find;
use File::Copy;

my %Extension = (
 dwg => '1',
 xls => '1',
 bp2 => '1',
 doc => '1',
 plx => '1',
 html => '1',
);

my @Files;
while (<DATA>) {
        chomp;
        my $path = "D:/$_";
        &find (\&wanted, $path);
}

sub wanted {

return if -d $_;
(my $ext = $_) =~ s/^.*\.(.*?)$/$1/;
return unless exists $Extension{lc $ext};
if (-M _ < 1) {
        push @Files, $File::Find::name;
}

}

print "The following files need backup:\n";
foreach (@Files) {
        print "\t$_\n";
        # do backup here or up where I did the push
}

__DATA__
Perluser
Perluser-old


-- 
  ,-/-  __      _  _         $Bill Luebkert   ICQ=14439852
 (_/   /  )    // //       DBE Collectibles   http://www.todbe.com/
  / ) /--<  o // //      Mailto:[EMAIL PROTECTED] http://dbecoll.webjump.com/
-/-' /___/_<_</_</_    http://www.freeyellow.com/members/dbecoll/
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to