Last active
February 26, 2023 05:44
-
-
Save funwarioisii/cddf44744c9cb1a348f504ee16b8349e to your computer and use it in GitHub Desktop.
This is a script that uploads files from an external storage device connected to macOS to Google Cloud Storage and copies them to the appropriate directory based on their file type.
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
def execute? = ENV["EXECUTE"] == '1' | |
date = Time.now.strftime("%Y%m%d") | |
sources = Dir.glob("/Volumes/Untitled/DCIM/*") | |
gcs_path = "gs://funwarioisii-photo-backup" | |
sources.each do |source| | |
command = "gcloud storage cp #{source}/* #{gcs_path}/original/#{date}" | |
print "RUN: #{command}\n" | |
if execute? | |
`#{command}` | |
end | |
end | |
command = "gcloud storage cp '#{gcs_path}/original/#{date}/*.MOV' #{gcs_path}/movie && gcloud storage cp '#{gcs_path}/original/#{date}/*.MOV' #{gcs_path}/movie" | |
print "RUN: #{command}\n" | |
if execute? | |
`#{command}` | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment