mirror of
https://github.com/immich-app/immich.git
synced 2025-05-31 12:15:47 -04:00
* 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>
35 lines
1.6 KiB
Markdown
35 lines
1.6 KiB
Markdown
# Remove Offline Files
|
|
|
|
:::note
|
|
**Before running the script**, please make sure you have a [backup](/docs/administration/backup-and-restore) 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](/docs/api/delete-assets) 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](https://discord.com/channels/979116623879368755/1179655214870040596/1194308198413373482) for writing this script.
|