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

here's a simplified Unix way.

$ export LASTFILE=`ls -t | head -n 1` $ for MYFILE in `ls | grep -Ev $LASTFILE` ; do mv $MYFILE newdir; done
  • Comment on Re: Unix - Keep the last modified file in the directory and move/copy the rest of the files.
  • Download Code