Transfering photos from Google Cloud to Microsoft Cloud using a private server

Tasked with transfering photos of IT illiterate family, who has no idea that google has been confiscating their images? Fear no more! Here is what I've done to complete this process without losing any (important) information.

Exporting the files

We are going to find photographs stored in two places:

  • Google Drive
  • Google Photos

We are going to use the https://takeout.google.com/ service to handle the entire export.
In Takeout UI, click "uncheck everything" & then select Drive & Photos services for export.
I have chosen to send the zip to oneDrive account, so I don't have to use local connection to transfer anything.

Pulling the files onto a VPS

Google had sent our images to oneDrive in big .zip archives. To get images out of them, I am going to use a fast VPS with NVME SSD to process them.

  1. Install OneDrive For Linux
  2. Auth OneDrive
  3. Create single directory for managing onedrive files
    1. We are going to download only the archives from Takeout service & upload photos. No need to make space for any other data
  4. Create config file
    1. cp /etc/onedrive/config ~/.config/onedrive/config
    2. Set sync_dir to created directory for onedrive files
  5. Download the archives
    1. onedrive --sync --download-only --single-directory 'Aplikacje/Google Download Your Data'
    2. You should find the Takeout files in the onedrive data directory
  6. We need contents of the archive, so extract them
    1. unzip takeout-****

Organising the files

Google likes to go out of their way to violate data storage standards & use their own, so we are going to need a tool to get everything back in one place
  1. To only get images & make sure their metadata is correct, we are going to use Google Photos Takeout Helper.
  2. It is enough to follow the instructions in readme, with one caveat.
    1. To omit the (buggy) interactive part of the application, specify input & output directories as arguments

./gpth-linux -i ~/oneDrive/data/Takeout/ -o ~/oneDrive/data/output/

All images should now be inside ~/oneDrive/data/output/ALL_PHOTOS directory.
Some more images can be found in sub-directories. These are part of compilations & shared folders. You can try to move them to ALL_PHOTOS, but most of them are going to be already part of the ALL_PHOTOS directory.

Pushing the organised images back to oneDrive

oneDrive for Linux automagically recreates local folder structure in Cloud.

To not overwrite any data that is already stored on oneDrive, I recommend creating a temporary directory, just for upload. We can organise uploaded data later, when it is already in the cloud.

Just, Remember to create directories structure, you want to see in the service.

  1. Move all images to directory you are going to upload to oneDrive.
  2. Execute onedrive --sync --upload-only --resync --resync-auth

Maintenance

Now, when all images are available in oneDrive, it is a good time to look through them & move them to your main photos directory, so they can be viewed & organised through Microsoft Photos.

We can move files around without downloading them locally. Either through desktop oneDrive, or web UI.