1
0
mirror of https://github.com/immich-app/immich.git synced 2024-11-24 08:52:28 +02:00

docs: Update remove-offline-files.md (#6449)

The previous Windows Powershell script didn't work - resulted in a bunch of errors due to multiple reasons.  The revised code works as expected.
This commit is contained in:
Hiren Shah 2024-01-17 16:40:33 +00:00 committed by GitHub
parent 702e91145a
commit a7768cc64d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -23,11 +23,15 @@ awk -F\" '/entityId/ {print $4}' orphans.json | while read line; do curl --locat
```
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"]}"
$line = $_ -split '"' | Select-Object -Index 3
$body = [pscustomobject]@{
'ids' = @($line)
'force' = (' true ' | ConvertFrom-Json)
} | ConvertTo-Json -Depth 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 $body
}
```