1
votes

On my Google VM disk I'm creating various video files.

The video files need to be accessible on my disk for an hour, but after that period, I want to move them to a Google Cloud bucket.

What would the gsutil command be to copy/move files over a certain age?

Currently I'm storing the creation of these videos in a database and calling a script that generates the filenames to be moved. But surely gsutil can do this for me using the file's age?

1
gsutil does not do any special processing of local files (e.g., gsutil cp works more or less like cp which also doesn't query file timestamps), so you would need to generate the list of files externally, or via a shell script which would look at the modification times of the files, or as you do via querying the database. - Misha Brukman

1 Answers

2
votes

If you can incorporate a timestamp into the start of your object names you could list objects in age order and then copy/move ones older than some threshold.