immich/docs/docs/guides/remove-offline-files.md
aviv926 df4af025d7
Edit and update of FAQ+new database GUI guide (#5958)
* Update added and re -arrangement of FAQ

* Erasure of addition mistakes

* Erasure of addition mistakes

* Fix broken links

* Correcting spelling errors + adding more questions

* New required fixes

* More FAQ

* Adding questions + adding a note about a directory and an explanation about adding a path in a Windows environment

* Update docs/docs/FAQ/Albums-FAQ.md

Co-authored-by: Mert <101130780+mertalev@users.noreply.github.com>

* Update docs/docs/FAQ/Assets-FAQ.md

Co-authored-by: Mert <101130780+mertalev@users.noreply.github.com>

* Update docs/docs/FAQ/Machine-Learning-FAQ.md

Co-authored-by: Mert <101130780+mertalev@users.noreply.github.com>

* Update docs/docs/FAQ/Machine-Learning-FAQ.md

Co-authored-by: Mert <101130780+mertalev@users.noreply.github.com>

* Update docs/docs/features/libraries.md

Co-authored-by: Mert <101130780+mertalev@users.noreply.github.com>

* Corrections

* chore: updates

* import TOCinlines from all FAQ pages to one page + Corrections

* Removing privacy information + adding required Flutter version information

* Removing privacy information + adding required Flutter version information

* Revert "Removing privacy information + adding required Flutter version information"

This reverts commit da63439fd212b2ddd578fb6ca860f1a8bcd0bb45.

* All in one page

* Guide - Remove Offline Files

* Guide - Remove Offline Files

* doc: updates

* chore: fix broken link

* docs: clean up database gui guide

---------

Co-authored-by: Alex <alex.tran1502@gmail.com>
Co-authored-by: Mert <101130780+mertalev@users.noreply.github.com>
Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
2024-01-12 14:45:41 -05:00

1.6 KiB

Remove Offline Files

:::note Before running the script, please make sure you have a backup of your assets and database :::

This page is a guide to get rid of offline files from the repair page.

This way works by downloading a JSON file that contains a list of all the files that are defined as offline files, running a script that uses the Immich API in order to remove the offline files.

  1. Create an API key under Admin User -> Account Settings -> API Keys -> New API Key -> Copy to clipboard.
  2. Download the JSON file under Administration -> repair -> Export.
  3. Replace YOUR_IP_HERE and YOUR_API_KEY_HERE with your actual IP address and API key in the script.
  4. Run the script in the same folder where the JSON file is located.

Script for Linux based systems:

awk -F\" '/entityId/ {print $4}' orphans.json | while read line; do curl --location --request DELETE 'http://YOUR_IP_HERE:2283/api/asset' --header 'Content- Type: application/json' --header 'x-api-key: YOUR_API_KEY_HERE' --data '{ "force": true, "ids": ["'"$line"'"]}';done

Script for the Windows system (run through PowerShell):

Get-Content orphans.json | Select-String -Pattern 'entityId' | ForEach-Object {
$line = line=$_ -split '"' | Select-Object -Index 3
Invoke-RestMethod -Uri 'http://YOUR_IP_HERE:2283/api/asset' -Method Delete -Headers @{
'Content-Type' = 'application/json'
'x-api-key' = 'YOUR_API_KEY_HERE'
} -Body "{"force": true, "ids": ["$line"]}"
}

Thanks to DooMRunneR for writing this script.