Created
February 20, 2018 21:50
-
-
Save catichenor/205d2c2f7d488db2d8f6bda68539757f to your computer and use it in GitHub Desktop.
Copy a large list of sequential files to GCS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in `seq -f '%06g' 1 10`; do echo "/path/to/file.${i}.png"; done | xargs > ./filelist.txt | |
# ^Generate a space-delimited list of filenames and output it to `filelist.txt`. | |
# Contents of `filelist.txt`: | |
# /path/to/file.000001.png /path/to/file.000002.png /path/to/file.000003.png /path/to/file.000004.png /path/to/file.000005.png /path/to/file.000006.png /path/to/file.000007.png /path/to/file.000008.png /path/to/file.000009.png /path/to/file.000010.png | |
gsutil cp -m `cat ./filelist.txt` gs://png-bucket/path/to/receptacle/ | |
# ^Read the list of files as an argument to gsutil and use multithreaded copy to copy to the bucket. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Maybe can be written as:
gsutil cp -m $(for i in `seq -f '%06g' 1 10`; do echo "/path/to/file.${i}.png"; done | xargs) gs://png-bucket/path/to/receptacle/