How can I copy the 2 most recent updated files from a directory? I'v searched for a while now and I can't seem to find it..
If anyone can help me I would really appreciate that!
You can use this
rsync `ls -tp | grep -v / | head -n 2` <destination> <options>
Just make changes in appropriate places and it'll work.
for i in `ls -rt | tail -n2` ; do cp $i <dest> ; done
ls -rt
sorts the files in reverse order on the basis of modification time.