in reply to File playback with lag
Note that this is not the most efficient possible solution. If you have a lot of files in that directory, the sort routine will be quite busy checking each file's modification time multiple times while it sorts.opendir(DIR,$archivedir) || die "Could not open $archivedir:$!\n"; foreach (readdir(DIR)) { # put all the non-dir files into array push(@files,"$archivedir/$_") if -f "$archivedir/$_"; } @files=sort {(-M $a)<=>(-M $b)} @files;
If you have just a few files there, it doesn't matter. If you have hundreds, you might want to apply the Schwartzian transform to that sort.
|
|---|