in reply to Re: Unix - Keep the last modified file in the directory and move/copy the rest of the files.
in thread Unix - Keep the last modified file in the directory and move/copy the rest of the files.

my @files = sort { -M $a <=> -M $b } readdir SRC;
readdir doesn't prepend the SRC directory to the filename for you, so if your cwd is not the source directory, you will get strange results from that code.

Makeshifts last the longest.

  • Comment on Re^2: Unix - Keep the last modified file in the directory and move/copy the rest of the files. (common readdir trap)
  • Download Code