The Watch Command or tail for directories

I had a long running job copying some huge media archives from external storage to a new server. I wanted to periodically keep tabs on the process and as I was using cp to copy the data I made sure to use the -v argument so that there was some feedback to the terminal to tell me how things were progressing:
cp -Rv usbhdd/ /home/media/
Whilst doing this I thought that it would be cool to have a version of tail that worked for directories rather than just for files. Well it turns out that you can, after a fashion. There is the watch command which gives similar functionality by causing a command to be executed periodically and the results displayed fullscreen:
watch -n 10 "ls -la"
This will cause the ls -la command to be executed every ten seconds and the result displayed. Whilst finding out about this I discovered that the watch command isn't on every system and that the following script can be used to provide the same functionality:
#!/bin/sh
while (true)
do
     ls -lrt | tail -5
     sleep 5
     clear
done
Which works but causes the screen to clear each time which is distracting, and doesn't have the niceties of the watch command like using the -d differences flag to show how the output changes between successive updates.
Posted
Views