I am interested in modifying a bash script file whose purpose is to copy large amount of files to destination path. What i'm trying to achieve is count the number of files as they are being copied. How can i achieve the objective state above ?
I assume that your file names do not contain a newline.
cp -v file* targetdir | cat -n
1 `file_123.png' -> `targetdir/file_123.png' 2 `file_207.txt' -> `targetdir/file_207.txt' 3 `file_44.png' -> `targetdir/file_44.png'
or only numbers (GNU sed):
cp -v file* targetdir | sed -n '/.*/='