# Snapshots

> Save a complete copy of your iPod, get offered one before risky syncs, and restore the iPod to exactly how it was.

A snapshot is a complete copy of everything on your iPod, saved on your Mac: songs, videos, databases, artwork,
photos, and any files you keep on it in disk mode. If a sync doesn't go the way you wanted, or you want the iPod back
as it was before ClassicTunes first touched it, you can restore a snapshot and the iPod is put back exactly.

Snapshots are incremental. The first one copies the whole iPod; after that, only files that changed since the
previous snapshot are copied, and the rest are shared with it, so later snapshots take little time and little space.

> **Note:** ClassicTunes never takes a snapshot without asking. A first snapshot of a full hard-drive iPod can take
> an hour.

## Take a snapshot

On the iPod's page, in **Backups**, click **Take Snapshot**. Progress shows below the button ("Copying 1.2 GB of
24 GB"), and you can click **Cancel** at any time; a snapshot that didn't finish is never listed.

You can't take a snapshot while the iPod is syncing, or while another snapshot or a restore is running. When
ClassicTunes is in the background, it can show a notification when the snapshot is saved (**Settings › General ›
Notifications**).

## Offered before a sync

Before some syncs, ClassicTunes asks whether to take a snapshot first (for example, "Take a snapshot of “Jack’s iPod”
first?"):

- **Before ClassicTunes first syncs an iPod**, when the iPod has no snapshots yet.
- **Before a sync that removes a lot**: at least 100 songs, or a quarter of the songs on the iPod.

The window explains why, and how long it will take: the size of the iPod and an estimated time for a first snapshot,
or "Only what changed since its last snapshot is copied." for later ones. Choose:

- **Take Snapshot, Then Sync**: saves the snapshot, then syncs. If the snapshot doesn't finish, the iPod isn't
  synced, and the page says why.
- **Sync Without Snapshot**: syncs straight away.
- **Cancel**: neither.

Syncs started from AppleScript or Shortcuts ask in the same way, and wait until you answer in ClassicTunes.

You can turn either offer off in **Settings › Backups**.

## Reminders

The **Backups** section reminds you, in orange, when it's time for a new snapshot:

- "This iPod has no snapshot yet." once the iPod has been synced without one.
- "The last snapshot is over a month old." (or "over a week old"), depending on **Remind me to take a new snapshot**
  in **Settings › Backups**.

## The snapshot list

Each iPod's page lists its snapshots, newest first. The top line says when it was last backed up and how many
snapshots there are. Each row shows:

- When the snapshot was taken.
- Why: **Manual**, **Before first sync**, **Before a large sync** or **Before restoring**.
- How many song files it holds and the iPod's total size, with how much was newly copied for this snapshot, such as
  "24 GB (310 MB new)".

The **⋯** menu beside each snapshot has **Show in Finder** and **Delete…**.

## Restore a snapshot

Restoring makes the iPod match the snapshot exactly.

1. Connect the iPod the snapshot was taken from.
2. Click **Restore…** beside the snapshot.
3. Read the confirmation, and click **Restore**.

What happens:

- **A snapshot of the iPod as it is now is taken first**, labeled **Before restoring**, so you can undo the restore by
  restoring that one.
- Songs, playlists, photos and files added since the snapshot are removed, and anything removed since comes back.
- **ClassicTunes' record of the iPod goes back to that time too**: what it had synced and the iPod's sync settings.
  The next sync carries on from there. If the snapshot was taken before ClassicTunes had ever synced the iPod,
  ClassicTunes forgets the iPod instead, as if it were new.
- Only what's different is copied. The iPod stays usable throughout: missing files are copied first, then changed
  files and the databases are swapped in whole, and only then are extra files deleted. Stopping part-way leaves at
  worst some extra files. (If there isn't enough space for that order, extra files are deleted first, and the restore
  can't be canceled after that point.)

When it's done, the page says "Restored the snapshot from…". Eject the iPod before unplugging it.

What a restore never does:

- **It never removes click wheel games or winds back their saves.** Games, their saved progress and the file that
  unlocks them only come back from the snapshot when the iPod no longer has them.
- **It leaves alone folders the snapshot didn't have**, so other things you keep on the iPod's disk stay.
- **It only restores onto a real iPod.** The disk must identify itself as an Apple iPod over USB, and the snapshot
  must be one taken from that iPod.

> **Important:** You can't restore while the iPod is syncing, taking a snapshot or already restoring.

## Delete a snapshot

Choose **Delete…** from the snapshot's **⋯** menu, then **Delete**. The snapshot can't be restored afterward. Files it
shares with other snapshots stay with them, so deleting one never damages another.

"Before a large sync" snapshots are deleted automatically, keeping the newest few (five to start with). Other
snapshots are kept until you delete them.

## Settings › Backups

These settings apply to every iPod and every library.

| Setting | What it does |
| --- | --- |
| **Offer a snapshot before ClassicTunes first syncs an iPod** | Asks before an iPod's first sync, when it has no snapshots. On to start with. |
| **Offer a snapshot before a sync that removes a lot** | Asks before a sync that removes at least 100 songs, or a quarter of the songs on the iPod. On to start with. |
| **Remind me to take a new snapshot** | **Never**, **After a week** or **After a month** (the starting choice). |
| **Keep the newest … "before a large sync" snapshots** | How many of those to keep, from 1 to 50 (5 to start with). |
| **Where snapshots are kept** | The folder for new snapshots. **Change…** picks another (an external drive, for example); **Use Default** goes back. |

Snapshots are kept in `~/Library/Application Support/ClassicTunes iPod Backups` unless you choose another folder. Each iPod has its own folder inside it, with a folder for each snapshot.

Snapshots already taken stay where they are when you change the folder. An APFS-formatted drive keeps snapshots
smallest, because unchanged files are cloned and take no extra space; on other drives they're shared as hard links.

## What's in a snapshot

- Everything on the iPod's disk, at the same paths: the music folders, the iPod's databases, artwork, photos, click
  wheel games, and files kept in disk mode.
- ClassicTunes' record of the iPod at that moment, so a restore can put it back.
- Not included: macOS's own housekeeping files and folders (Spotlight, Trash, `.DS_Store` and the like).

## From AppleScript and Shortcuts

`back up` takes a snapshot and returns the date it was taken. `last backup` and `snapshot count` tell you about an
iPod's snapshots. A first snapshot can take a long time, so give it a long timeout:

```applescript
tell application "ClassicTunes"
    set myIPod to iPod 1
    log "Snapshots so far: " & (snapshot count of myIPod)
    with timeout of 7200 seconds
        set takenAt to back up myIPod
    end timeout
    display notification "Snapshot saved at " & (takenAt as text)
end tell
```

In Shortcuts (macOS 13 and later), use **Back Up iPod**, which returns when the snapshot was taken. Siri also
suggests "Back up my iPod with ClassicTunes". Restoring and deleting snapshots can only be done in the app. See
[AppleScript](https://classictunes.app/docs/applescript) and [Shortcuts](https://classictunes.app/docs/shortcuts).
