1 Reply Latest reply on Feb 7, 2013 4:40 AM by Techi Panda

    perl script

    hurix@123 Level 1

      Hi,

       

      I created watch folder using Perl script

      My Code is Below

       

      #!/usr/bin/perl

      #OM

      #Watch Folder Script

      use warnings;

      use File::Copy;

      my $indir = "/Users/hpt/Desktop/In";

      my $outdir = "/Users/hpt/Desktop/Out";

      while(1)

      {

      opendir (DIR, "$indir") or die "Cannot open $indir: $!\n";

      @files = grep(/\.xml$/, readdir (DIR));

      close DIR;

      $count = @files;

      if($count>0)

      {

      foreach my $file(@files)

      {

      Here I have to  run my "XXX.jsx" file

       

      my $old = "$indir/$file";

      move($old, $outdir) or die "Move $old -> $outdir failed:$!";

      }

      exit;

      }

      else{sleep 10;}

      system("perl /Users/hpt/Desktop/Perl/new.pl");

      }

       

      Please help me if know any one.

       

      Hurix