Base de conhecimento

1000 perguntas frequentes, 500 tutoriais e vídeos explicativos. Aqui, você encontra apenas soluções!

Importar as fotos do Google para o kDrive

Atualização 12/11/2026

Este guia explica como exportar as suas fotos do Google Fotos (https://photos.google.com/) e, em seguida, importá-las para o kDrive da Infomaniak.

 

Introdução

  • Outros guias de importação disponíveis:
    • Dropbox, através do assistente kDrive (❓: ajuda)
    • Microsoft OneDrive, através do assistente kDrive (❓: ajuda)
    • Qualquer kDrive acessível pelo mesmo utilizador, através do assistente kDrive (❓: ajuda)
    • Qualquer fornecedor compatível, através do rclone (❓: ajuda)
      • Exemplo Google Drive (❓: ajuda)
      • Exemplo Apple iCloud (❓: ajuda)

 

1. Exportar as suas fotos do Google

Para recuperar as fotos armazenadas no Google Fotos no seu computador, utilize o Google Takeout. Este serviço permite exportar todos os itens ou selecionar apenas alguns álbuns, caso prefira proceder por etapas:

  1. Aceda a Google Takeout.
  2. Desmarque todos os produtos para manter apenas o Google Fotos:
  3. Se necessário, desmarque os álbuns que não deseja exportar:
  4. Passe para a etapa seguinte, na parte inferior da página:
  5. Configure a exportação para o formato ZIP.
  6. Clique no botão Criar uma exportação para iniciar a exportação:
  7. Aguarde até receber o e-mail contendo os links para download. Dependendo do volume de dados, a preparação da exportação pode levar várias horas ou até vários dias.
  8. Descarregue os arquivos ZIP e, em seguida, descompacte-os no seu computador:
  9. Se necessário, agrupe as pastas exportadas antes de as importar para o kDrive.

 

2. Corrigir as datas dos arquivos exportados

Durante uma exportação, as datas do sistema dos arquivos podem ser substituídas pela data de exportação em vez da data original da captura. Se a ordem cronológica das fotos não estiver correta após a exportação, você pode corrigir essas datas antes de importar para o kDrive.

Antes de executar um script, trabalhe em uma cópia dos seus arquivos exportados. Não exclua os arquivos .json fornecidos pelo Google Takeout antes do processamento: eles podem conter a data original quando esta não estiver disponível nos metadados EXIF do arquivo.

Os scripts abaixo procuram uma data nesta ordem: metadados do arquivo, arquivo JSON do Google Takeout associado e, em seguida, a data presente no nome do arquivo. Os arquivos sem uma data utilizável são listados em um arquivo DateError.txt criado na área de trabalho. Os arquivos corrigidos são listados em DateFound.txt.

Para limitar os riscos de bloqueio em exportações muito grandes, processe os arquivos em lotes de alguns milhares de itens.

 

Corrigir as datas no macOS

  1. Faça o download e instale o ExifTool em https://exiftool.org/index.html, selecionando o pacote macOS.
  2. Abra o aplicativo Terminal na pasta Aplicativos > Utilitários.
  3. Copie e cole integralmente o bloco abaixo no Terminal e, se necessário, valide pressionando a tecla Enter.
  4. Selecione a pasta que contém os arquivos exportados do Google Takeout.
  5. Aguarde a conclusão do processo e, em seguida, consulte os arquivos DateFound.txt e DateError.txt criados na área de trabalho.

O script a ser copiado e colado integralmente:

/bin/bash <<'BASH'
#!/bin/bash
set -u

ROOT="$(osascript -e 'POSIX path of (choose folder with prompt "Select the folder containing the files to update")')" || exit 0

DESKTOP="$HOME/Desktop"
LOG_FOUND="$DESKTOP/DateFound.txt"
LOG_ERROR="$DESKTOP/DateError.txt"
: > "$LOG_FOUND"
: > "$LOG_ERROR"

find_exiftool() {
    if command -v exiftool >/dev/null 2>&1; then
        command -v exiftool
        return 0
    fi
    if [ -x "/usr/local/bin/exiftool" ]; then
        printf '%s\n' "/usr/local/bin/exiftool"
        return 0
    fi
    if [ -x "/opt/homebrew/bin/exiftool" ]; then
        printf '%s\n' "/opt/homebrew/bin/exiftool"
        return 0
    fi
    return 1
}

EXIFTOOL="$(find_exiftool)" || {
    printf '%s\n' "ExifTool not found. Install it, then run the script again." >> "$LOG_ERROR"
    printf '%s\n' "ExifTool not found. Check DateError.txt on the desktop."
    exit 1
}

if [ ! -d "$ROOT" ]; then
    printf 'Invalid folder: %s\n' "$ROOT" >> "$LOG_ERROR"
    printf '%s\n' "Invalid folder. Check DateError.txt on the desktop."
    exit 1
fi

get_exif_date() {
    "$EXIFTOOL" -s3 -d "%Y:%m:%d %H:%M:%S" -DateTimeOriginal -CreateDate -MediaCreateDate -TrackCreateDate -CreationDate -ModifyDate -- "$1" 2>/dev/null | awk '/^[0-9]{4}:[0-9]{2}:[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/ { print substr($0, 1, 19); exit }'
}

get_json_date() {
    local file="$1"
    local json=""
    if [ -f "$file.json" ]; then
        json="$file.json"
    elif [ -f "${file%.*}.json" ]; then
        json="${file%.*}.json"
    fi
    [ -z "$json" ] && return 1

    /usr/bin/perl -MTime::Piece -0777 -ne 'if (/"photoTakenTime"\s*:\s*\{.*?"timestamp"\s*:\s*"([0-9]+)"/s || /"creationTime"\s*:\s*\{.*?"timestamp"\s*:\s*"([0-9]+)"/s) { print localtime($1)->strftime("%Y:%m:%d %H:%M:%S"); }' "$json"
}

get_name_date() {
    local name
    name="$(basename "$1")"
    if [[ "$name" =~ ([12][0-9]{3})[-_]?([01][0-9])[-_]?([0-3][0-9])([_\ -]?([0-2][0-9])[-_\.]?([0-5][0-9])[-_\.]?([0-5][0-9]))? ]]; then
        local year="${BASH_REMATCH[1]}"
        local month="${BASH_REMATCH[2]}"
        local day="${BASH_REMATCH[3]}"
        local hour="12"
        local minute="00"
        local second="00"
        if [ -n "${BASH_REMATCH[5]:-}" ]; then
            hour="${BASH_REMATCH[5]}"
            minute="${BASH_REMATCH[6]}"
            second="${BASH_REMATCH[7]}"
        fi
        printf '%s:%s:%s %s:%s:%s\n' "$year" "$month" "$day" "$hour" "$minute" "$second"
        return 0
    fi
    return 1
}

is_valid_date() {
    date -j -f "%Y:%m:%d %H:%M:%S" "$1" "+%Y:%m:%d %H:%M:%S" >/dev/null 2>&1
}

to_touch_date() {
    printf '%s' "$1" | sed -E 's/^([0-9]{4}):([0-9]{2}):([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})$/\1\2\3\4\5.\6/'
}

write_metadata() {
    local file="$1"
    local date_value="$2"
    "$EXIFTOOL" -overwrite_original "-DateTimeOriginal=$date_value" "-CreateDate=$date_value" "-ModifyDate=$date_value" -- "$file" >/dev/null 2>&1 || true
}

process_file() {
    local file="$1"
    local date_value=""
    local source=""

    date_value="$(get_exif_date "$file")"
    if [ -n "$date_value" ]; then
        source="EXIF"
    else
        date_value="$(get_json_date "$file")"
        if [ -n "$date_value" ]; then
            source="Google Takeout JSON"
        else
            date_value="$(get_name_date "$file")"
            if [ -n "$date_value" ]; then
                source="file name"
            fi
        fi
    fi

    if [ -n "$date_value" ] && is_valid_date "$date_value"; then
        local touch_value
        touch_value="$(to_touch_date "$date_value")"
        if [ "$source" != "EXIF" ]; then
            write_metadata "$file" "$date_value"
        fi
        if touch -t "$touch_value" "$file" 2>/dev/null; then
            printf '%s | %s | %s\n' "$source" "$date_value" "$file" >> "$LOG_FOUND"
        else
            printf 'Unable to update file date: %s\n' "$file" >> "$LOG_ERROR"
        fi
    else
        printf 'No valid date found: %s\n' "$file" >> "$LOG_ERROR"
    fi
}

while IFS= read -r -d '' file; do
    case "$file" in
        *.json|*_original) continue ;;
    esac
    process_file "$file"
done < <(find "$ROOT" -type f -print0)

printf '%s\n' "Done. Check DateFound.txt and DateError.txt on the desktop."
BASH

 

Corrigir as datas no Windows

  1. Descarregue o ExifTool em https://exiftool.org/index.html, selecionando o executável para Windows.
  2. Coloque-o numa pasta acessível, por exemplo C:\ExifTool.
  3. Renomeie o ficheiro exiftool(-k).exe para exiftool.exe.
  4. Verifique se o caminho completo é realmente C:\ExifTool\exiftool.exe.
    • Se você colocar o ExifTool em outro local, modifique a primeira linha de configuração do script abaixo.
  5. Copie e cole o script abaixo no Bloco de Notas.
  6. Salve o arquivo com a extensão .ps1, por exemplo, UpdateExifDates.ps1.
  7. Clique com o botão direito do mouse no arquivo .ps1 e execute-o com o PowerShell.
  8. Selecione a pasta que contém os arquivos exportados do Google Takeout.
  9. Aguarde a conclusão do processo e, em seguida, consulte os arquivos DateFound.txt e DateError.txt criados na área de trabalho.

Se o PowerShell bloquear a execução do script, abra o PowerShell e execute o comando Set-ExecutionPolicy RemoteSigned -Scope CurrentUser e, em seguida, confirme a alteração quando o Windows solicitar.

O script a ser copiado e colado na íntegra:

# === Configuration ===
$ExifToolPath = "C:\ExifTool\exiftool.exe"
$Desktop = [Environment]::GetFolderPath("Desktop")
$LogFound = Join-Path $Desktop "DateFound.txt"
$LogError = Join-Path $Desktop "DateError.txt"
Set-Content -Path $LogFound -Value ""
Set-Content -Path $LogError -Value ""

if (-not (Test-Path -LiteralPath $ExifToolPath)) {
    Add-Content -Path $LogError -Value "ExifTool not found: $ExifToolPath"
    Write-Host "ExifTool not found. Check the path in the script."
    exit
}

# === Folder selection dialog ===
Add-Type -AssemblyName System.Windows.Forms
$FolderBrowser = New-Object System.Windows.Forms.FolderBrowserDialog
$FolderBrowser.Description = "Select the folder to process"
if ($FolderBrowser.ShowDialog() -ne [System.Windows.Forms.DialogResult]::OK) { exit }
$Folder = $FolderBrowser.SelectedPath

function Get-DateFromExif {
    param ([string]$FilePath)

    $Tags = @("DateTimeOriginal", "CreateDate", "MediaCreateDate", "TrackCreateDate", "CreationDate", "ModifyDate")
    foreach ($Tag in $Tags) {
        $Value = (& $ExifToolPath "-$Tag" -s3 -d "%Y:%m:%d %H:%M:%S" -- "$FilePath" 2>$null | Select-Object -First 1)
        if ($Value -match '^(\d{4}):(\d{2}):(\d{2}) (\d{2}):(\d{2}):(\d{2})') {
            try {
                return [datetime]::ParseExact($Matches[0], "yyyy:MM:dd HH:mm:ss", [Globalization.CultureInfo]::InvariantCulture)
            } catch {}
        }
    }
    return $null
}

function Get-DateFromJson {
    param ([string]$FilePath)

    $JsonPaths = @("$FilePath.json", [System.IO.Path]::ChangeExtension($FilePath, ".json")) | Select-Object -Unique
    foreach ($JsonPath in $JsonPaths) {
        if (Test-Path -LiteralPath $JsonPath) {
            try {
                $Json = Get-Content -LiteralPath $JsonPath -Raw -ErrorAction Stop | ConvertFrom-Json -ErrorAction Stop
                $Timestamp = $null
                if ($Json.photoTakenTime -and $Json.photoTakenTime.timestamp) {
                    $Timestamp = [int64]$Json.photoTakenTime.timestamp
                } elseif ($Json.creationTime -and $Json.creationTime.timestamp) {
                    $Timestamp = [int64]$Json.creationTime.timestamp
                }

                if ($null -ne $Timestamp) {
                    return ([DateTimeOffset]::FromUnixTimeSeconds($Timestamp)).LocalDateTime
                }
            } catch {}
        }
    }
    return $null
}

function Get-DateFromFileName {
    param ([string]$FileName)

    if ($FileName -match '([12]\d{3})[-_]?(0[1-9]|1[0-2])[-_]?(0[1-9]|[12]\d|3[01])(?:[ _-]?([01]\d|2[0-3])[-_.]?([0-5]\d)[-_.]?([0-5]\d))?') {
        $Year = $Matches[1]
        $Month = $Matches[2]
        $Day = $Matches[3]
        $Hour = "12"
        $Minute = "00"
        $Second = "00"

        if ($Matches[4]) {
            $Hour = $Matches[4]
            $Minute = $Matches[5]
            $Second = $Matches[6]
        }

        $DateString = "$Year$Month$Day$Hour$Minute$Second"
        try {
            return [datetime]::ParseExact($DateString, "yyyyMMddHHmmss", [Globalization.CultureInfo]::InvariantCulture)
        } catch {}
    }
    return $null
}

function Write-Metadata {
    param (
        [string]$FilePath,
        [datetime]$DateValue
    )

    $ExifDate = $DateValue.ToString("yyyy:MM:dd HH:mm:ss", [Globalization.CultureInfo]::InvariantCulture)
    & $ExifToolPath -overwrite_original "-DateTimeOriginal=$ExifDate" "-CreateDate=$ExifDate" "-ModifyDate=$ExifDate" -- "$FilePath" 2>$null | Out-Null
}

function Set-FileDates {
    param (
        [string]$FilePath,
        [datetime]$DateValue
    )

    [System.IO.File]::SetCreationTime($FilePath, $DateValue)
    [System.IO.File]::SetLastWriteTime($FilePath, $DateValue)
    [System.IO.File]::SetLastAccessTime($FilePath, $DateValue)
}

Get-ChildItem -LiteralPath $Folder -Recurse -File | Where-Object {
    $_.Extension -ne ".json" -and $_.Name -notlike "*_original"
} | ForEach-Object {
    $File = $_
    $FilePath = $File.FullName
    $DateValue = Get-DateFromExif -FilePath $FilePath
    $Source = "EXIF"

    if (-not $DateValue) {
        $DateValue = Get-DateFromJson -FilePath $FilePath
        $Source = "Google Takeout JSON"
    }

    if (-not $DateValue) {
        $DateValue = Get-DateFromFileName -FileName $File.Name
        $Source = "file name"
    }

    if ($DateValue) {
        try {
            if ($Source -ne "EXIF") {
                Write-Metadata -FilePath $FilePath -DateValue $DateValue
            }
            Set-FileDates -FilePath $FilePath -DateValue $DateValue
            Add-Content -Path $LogFound -Value "$Source | $($DateValue.ToString('yyyy-MM-dd HH:mm:ss')) | $FilePath"
        } catch {
            Add-Content -Path $LogError -Value "Unable to update file date: $FilePath"
        }
    } else {
        Add-Content -Path $LogError -Value "No valid date found: $FilePath"
    }
}

[System.Windows.Forms.MessageBox]::Show("Done. Check DateFound.txt and DateError.txt on the desktop.")

 

3. Importar as fotos para o kDrive

Não altere as suas palavras-passe até que a importação ou a sincronização seja concluída.

Depois de preparar os seus ficheiros, pode importá-los através da aplicação web kDrive, desde que o número de ficheiros e a sua ligação à Internet permitam o envio através do navegador:

  1. Aceda à aplicação web kDrive da Infomaniak.
  2. Abra a pasta onde as fotos devem ser importadas.
  3. Clique no botão ‍ Novo no canto superior esquerdo.
  4. Clique em Importar pasta.
  5. Selecione a pasta que contém as suas fotos no seu computador.
  6. Aguarde até o final da importação. O registo de atividades é exibido no canto inferior direito:

Se estiver a utilizar a aplicação kDrive para desktop, também pode colocar a pasta que contém as suas fotos na estrutura da pasta kDrive no seu computador. A sincronização é então iniciada automaticamente e os ficheiros são enviados para os servidores Infomaniak.

 

4. Aceder às fotos a partir dos seus dispositivos

Após a importação ou sincronização ser concluída, as suas fotos estarão acessíveis a partir dos dispositivos conectados ao seu kDrive.

  • No aplicativo web kDrive, você pode modificar a exibição para ampliar as miniaturas e navegar mais facilmente pelas suas fotos:

Esta seção de perguntas frequentes foi útil?