It is just that I need to change FILE timestamp without having to login every time. Since scripts are not secure in maintaning username/password; I have seen an answered given by the monks to use Net::FTP; without using a login information opening the directory (remote machine w/ IP) like a file

#!/usr/bin/perl use strict; my %count; my $directory = "\\Test"; opendir( DIR, $directory ) || die "Unable to open directory - $!\n"; my @files = grep /\.txt/, readdir( DIR ); closedir( DIR ); open( OUTFILE, ">> $directory\\COID_LIST.txt" ) || die "Unable to open write file! - $!\n"; foreach my $file (@files) { open( FH, "$directory\\$file" ) || die "Unable to open $file - $!\n"; while( <FH> ) { my $ID = substr( $_, 260, 5 ); print OUTFILE "$ID\n"; $count{$ID}++ if ( defined( $ID ) ); } close( FH ); } print "Number of company ID = " . scalar keys %count; sub process_files { if ($File::Find::dir ne $dir) { $File::Find::prune = 1; return 0; } return 0 if ($_ !~ /\.txt$/); copy($File::Find::name, "\\temp\\$_") or die "Failed to copy $_: $ +!\n"; return 1; } find(\&process_files, $dir); Sub renaming_files { foreach my $file (glob "*.old") { my $newfile = $file; $newfile =~ s/\.old$/.new/; if (-e $newfile) { warn "can't rename $file to $newfile: $newfile exists\n"; } elsif (rename $file, $newfile) { ## success, do nothing } else { warn " rename $file to $newfile failed: $!\n"; } }
But opening the remote server like a file. Thus it requires time and specific information unless I do a quick search. I would like to know a routine to open this mode and not get kick-out with "connection close by remote server" message. Also estimated wait time on large files or logs are very hard to asses not impossible. I will thank any response by the monks.

In reply to Open Remote Directory by fluticasone

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.