IT-Wissen/atom/atom-tools-scripts.md
2024-10-14 17:47:20 +02:00

1.1 KiB
Executable File

Table of Contents

AtoM Tools and Scripts

Corrupt DB

Database Integrity Tool. If AtoM DB is corrputed, use this php tool, provided by Artefactual (worked well for BIS)

Powershell Script Refcode to ID,ParentID

$counter = 0
$refcode_delimiter = '.'
$list = [Ordered]@{}

Import-Csv -Path .\997-ordnungssystem.csv -Delimiter "," | sort n | ForEach-Object {
  $arr_id_parentid = @()
  $counter++
  $arr_id_parentid += $counter
  $list.add($_.n, $arr_id_parentid)
}

foreach ($h in $list.GetEnumerator() ) {
  $key = $h.Name
  #Write-Host "key: "$key
  if ($key -like '*.*') {
    $s = $key.Substring(0, $key.lastIndexOf('.'))
    $h.Value += $list[$s][0]
  } else {
    $h.Value += 'fribourg-archives-numeriques'  # slug of existing place in AtoM for the top level descriptions.
  }
  
  $a = $h.Value
  Write-Host ($a -join ",")
}