I am trying to make a copy of a file in a folder and I want to write a function to calculate how much of the file remains to be copied.
I can implement it in the terminal with two commands.
The first command will get all files in the folder - before processing
find . -type f | wc -l
=> counter1
-number of original file
And the second command will get all files already in the folder at current time.
find . -type f | wc -l
=> counter2
-number of the original file+ its coping
So, file_remaining = counter1 * 2 - counter2
counter1
is multiplied by 2 because I want to make a copy file
How can I make a function to get the information from the two commands in the Ubuntu terminal using C or C++?