title: Check file size and if file is not growing, then move it [readdir]
body: <p>I made script first for Windows platform and it worked. Now I have moved the script to Ubuntu and can not get it working.</p>
  <p>Is the problem in reading the filesize?</p>
  <pre><code>while ( opendir my $dirh, &quot;/share/Dropbox/test/in&quot; ) {
  
      while ( my $file = readdir $dirh ) {
  
          # filter . &amp; .. folders out
          next if ($file =~ m/^\./);
  
          my $size1 = -s $file;
          print &quot;$size1\n&quot;;
  
          sleep 2;
  
          my $size2 = -s $file;
          print &quot;$size2\n&quot;;
  
          if ( $size1 == $size2 ) {
              move( $file, &quot;/share/Dropbox/test/out&quot; );
          }
      }
  
      sleep 1;
  }
  closedir DIR;
  </code></pre>
  <p>And the warnings I get when running this:</p>
  <blockquote>
  <p>Use of uninitialized value $size1 in concatenation (.) or string at ./file_ready_2.pl line 20.</p>
  <p>Use of uninitialized value $size2 in concatenation (.) or string at ./file_ready_2.pl line 23.</p>
  <p>Use of uninitialized value $size2 in numeric eq (==) at ./file_ready_2.pl line 25.</p>
  <p>Use of uninitialized value $size1 in numeric eq (==) at ./file_ready_2.pl line 25.</p>
  <p>Use of uninitialized value $size1 in concatenation (.) or string at ./file_ready_2.pl line 20.</p>
  <p>Use of uninitialized value $size2 in concatenation (.) or string at ./file_ready_2.pl line 23.</p>
  </blockquote>