in reply to Get the latest file
The code is untested, but hopefully it can get the point across.#!/usr/bin/perl -w use strict; my $ftp_dir = '/pub/'; my @files = glob("$ftp_dir/*"); my ($latest_file,$modtime) = (0,0); foreach my $file (@files) { my $local_modtime = (stat($file))[9]; if ( $local_modtime > $modtime ) { $latest_file = $file; $modtime = $local_modtime; } } # There's probably a better way to make symlinks `ln -s $ftp_dir/$latest_file $ftp_dir/latest`;
|
|---|