Ali Khosro
Ali Khosro

Reputation: 1830

How can I find and copy using gsutil?

I know how to do it with for but is there an easy way?

touch temp/foo
for i in $(find my-dir/* -newer temp/foo);
do
gsutil -m cp -r "$i" gs://my-bucket/
done

Upvotes: 2

Views: 251

Answers (1)

jterrace
jterrace

Reputation: 67163

The gsutil cp -I parameter should help with this. It allows you to read the list of files to copy from stdin.

I think this would work:

find my-dir/* -newer temp/foo | gsutil -m cp -I gs://my-bucket/

Upvotes: 4

Related Questions