Hi. I'm new to Perl (just a couple of weeks).
I'm trying to write a script which will check the date of a local file,
compare it to a remote file (on another server on the same network), and
copy the local over if it is newer. I'm currently using the 'stat'
function. Here is part of the script:
#This is the source directory, where the file is built.
$sourceDir = 'c:\alldata\Godiva\slsmgtsp\rtsmarts';
$sourceFile = 'c:\alldata\Godiva\slsmgtsp\rtsmarts\rtsales.exe';
$sourceTimestamp =(stat($sourceFile))[9];
#This is the destination directory, where the file put for downloading
$destDir = '\\170.230.133.17\c$\inetpub\wwwroot\emp\files';
$destFile = '\\170.230.133.17\c
$\inetpub\wwwroot\emp\files\rtsales.exe';
$destTimestamp = (stat($destFile))[9];
However, whenever I do this, the $destTimestamp comes back blank (null,
zero-length-string, I'm not sure). I've resorted to copying the local file
into the directory where the script is kept each time I copy the file to
the server. Then at each run, I compare the local source file with the
local file kept in the script directory:
#This is the local directory, where the script is kept.
$localDir = 'c:\alldata\Godiva\slsmgtsp\rtsmarts';
$localFile = 'c:\alldata\rtsmarts\rtsales.exe';
$localTimestamp =(stat($localFile))[9];
I compare $localTimestamp to $sourceTimestamp because comparing
$sourceTimestamp to $destTimestamp. Is there a smarter way to do this?
By the way, this is COMPLETELY unrelated, but I received a really cool Perl
script with my latest issue of Linux Format magazine. It will split a
large mp3 into smaller, individually playable mp3s. (Useful: I can split
my 500mb audiobook mp3s into 5mb pieces, so that I can listen on my cd/mp3
player.) If anyone wants it, I'll e-mail it, or put up a link. The file
was created by Sean M. Burke of CPAN.org.
Thanks,
Shawn
**********************************************************************
This e-mail and any files transmitted with it may contain
confidential information and is intended solely for use by
the individual to whom it is addressed. If you received
this e-mail in error, please notify the sender, do not
disclose its contents to others and delete it from your
system.
**********************************************************************
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]