> For the complete documentation index, see [llms.txt](https://help.auxalia.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.auxalia.com/plant-tools/planttools/document-linking/workflows/clean-up-orphaned-links.md).

# Clean up orphaned links

{% hint style="danger" %}
**Not released yet.** This page describes a function of an upcoming release.
{% endhint %}

A link is orphaned when its object, drawing or drawing folder no longer exists. The links of an object you erase are removed when its drawing is closed and saved - not on a plain save, so the erase can still be undone. **Clean up Document Links** finds the rest, and also links files that lie in the document folder without a link.

1. Open PlantProjectManager and the Properties palette next to it. In the example, **Spec.pdf** is linked to the drawing **PID-002** - its **Docs** tab and the **Documents** node show it.

   ![](https://2994090777-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZH2AGHzvPfBW7YdaaGc0%2Fuploads%2Fgit-blob-616fdc1c92a48ca702a92d70e30a07fce10fe173%2FDL-clean-up-orphaned-links-0001.png?alt=media)
2. Right-click the drawing, choose **Remove Drawing** and then **Remove the drawing from this Project**. The drawing goes to the **Project Recycle Bin**, but its link to Spec.pdf stays - it is now orphaned.

   ![](https://2994090777-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZH2AGHzvPfBW7YdaaGc0%2Fuploads%2Fgit-blob-66b65c4bca178f33e73c13c13960c71221ba3248%2FDL-clean-up-orphaned-links-0002.png?alt=media)
3. A file copied into the project's document folder with Windows Explorer, here **Manual.pdf**, is linked to nothing - the **Documents** node does not list it.

   ![](https://2994090777-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZH2AGHzvPfBW7YdaaGc0%2Fuploads%2Fgit-blob-47720a7a62c2f3250fbbed4c5690e6c7a0727bf1%2FDL-clean-up-orphaned-links-0003.png?alt=media)
4. Right-click the project and choose **Clean up Document Links** - or enter the command `AQAPETCLEANUPDOCUMENTLINKS`.

   ![](https://2994090777-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZH2AGHzvPfBW7YdaaGc0%2Fuploads%2Fgit-blob-3aeda8457fdf5c52f3c633072a9b439a894e2e2e%2FDL-clean-up-orphaned-links-0004.png?alt=media)
5. PlantTools lists what it found: the orphaned links it would remove and the documents in the document folder it would link to the project. Click **OK** to do both, or **Cancel** to change nothing.

   ![](https://2994090777-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZH2AGHzvPfBW7YdaaGc0%2Fuploads%2Fgit-blob-8db1451960bbde003b6b82f856cf68fb92aa358f%2FDL-clean-up-orphaned-links-0005.png?alt=media)
6. PlantTools says how many links were removed and how many documents were linked to the project.

   ![](https://2994090777-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZH2AGHzvPfBW7YdaaGc0%2Fuploads%2Fgit-blob-b9819d413eb0706515d7a57bdda03b1529fa4e8e%2FDL-clean-up-orphaned-links-0006.png?alt=media)
7. Spec.pdf is no longer listed under the removed drawing, and Manual.pdf is now in the project's **Docs** tab.

   ![](https://2994090777-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZH2AGHzvPfBW7YdaaGc0%2Fuploads%2Fgit-blob-47720a7a62c2f3250fbbed4c5690e6c7a0727bf1%2FDL-clean-up-orphaned-links-0003.png?alt=media)

No file is deleted. The file of a removed link stays in the document folder, so the next clean-up offers to link it to the project. With **Scan for orphaned document files when a project is opened** in the [Settings](https://help.auxalia.com/plant-tools/planttools/document-linking/settings.md), files put into the document folder by hand are linked to the project each time it is opened.
