display number of files in current moment like what tail -f do

0

I have a folder which files are copied to it like /home/my/. I want to run a command which shows number of files inside it in real time like what tail -f do with file contents. I know I should run ls *|wc -l to count files but I don't know how to do it for monitoring and keep it running.

VSB

Posted 2016-04-15T17:56:32.293

Reputation: 265

@txtechhelp please post it as answer – VSB – 2016-04-18T09:58:15.530

Answers

1

If you have the watch command available on your distribution, you can run it like this:

watch -n 1 "ls /home/my"

This will run the ls /home/my command every n seconds (1 in this example) and will display the output to the screen.

Hope that can help.

txtechhelp

Posted 2016-04-15T17:56:32.293

Reputation: 3 317

0

Without watch you can try:

while sleep 1 ; do ls /home/my ; done

Kamil Maciorowski

Posted 2016-04-15T17:56:32.293

Reputation: 38 429