I need output of "gsutil cp" command to output.txt file. using ">" symbol its just printing on terminal, but not writing to output.txt
How can I do it? As it is taking few seconds to execute, I don't know about to deal asynchronous commands output.
If any body know, how to get generation of file after success of "cp"? I know how to display on terminal (using -v option in cp command). But I need only generation, as it is printing so many lines in output.
As the documentation states [1], the gsutil cp command allows you to copy data between your local file system and the cloud, within the cloud, and between cloud storage providers.
If you want to save the output of a gsutil cp command to a text file, here is an example:
gsutil cp your-file-here gs://your-bucket-here 2> result.txt
Using a file called hello.txt and one of my buckets, the content of result.txt is
Copying file://hello.txt [Content-Type=text/plain]...
/ [1 files][ 92.0 B/ 92.0 B]
Operation completed over 1 objects/92.0 B.
[1] - https://cloud.google.com/storage/docs/gsutil/commands/cp