in reply to print last file updated into directory
#!/usr/bin/perl use strict; use warnings; my $dir = '/tmp'; opendir(DIR, $dir) or die $!; while (my $file = readdir(DIR)) { # We only want files next unless (-f "$dir/$file"); # Use a regular expression to find files ending in .txt next unless ($file =~ m/\.txt$/); print "$file\n"; } closedir(DIR); exit 0;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: print last file updated into directory
by Anonymous Monk on Oct 31, 2014 at 01:47 UTC | |
by perlron (Pilgrim) on Oct 31, 2014 at 03:55 UTC | |
by Anonymous Monk on Oct 31, 2014 at 08:33 UTC | |
by perlron (Pilgrim) on Oct 31, 2014 at 10:16 UTC | |
by marto (Cardinal) on Oct 31, 2014 at 10:39 UTC | |
| |
by Anonymous Monk on Oct 31, 2014 at 11:28 UTC |