#1
Hi,

I am trying to copy files to a folder with progress tracking using the code snippet below.

The problem is that it outputs multiple array lines rather than a single array line.

How can I amend the code to output as single array line.

.

TK
#2
Hey TK,

With a little help from 'you know who' ;)
"To output a single array line containing the progress information, you can modify the code inside the foreach loop to accumulate the progress information into an array, and then echo the array after the loop has finished."

"In this updated code, the $progress variable is initialized as an empty array before the loop starts. Inside the loop, the progress information is stored in this array, overwriting the previous value with each iteration of the loop. Finally, after the loop has finished, the $progress array is echoed as a single JSON-encoded line."
#3
Huge thanks, this worked but the only problem now is that it the array values are being displayed after file copy completion.

I wanted to display real time progress values for each array value for example the percentage array should display 10%...20%..30%...and so on as soon as file copy begins.

much appreciated for any support provided.
#4
I now have this working.