Cli scripts

let's use the Joplin CLI to handle this in two stages:


🧩 Part 1: List All Folder (Notebook) IDs

This PowerShell script uses the Joplin CLI to list all folders and saves them to a file:

`powershell

Requires Joplin CLI installed and configured

Output file for folder list $folderListPath = "$env:USERPROFILE\Documents\joplin_folders.txt"

Run Joplin CLI to list folders joplin list folders --json | ConvertFrom-Json | ForEach-Object { "$($.id) `t $($.title)" } | Out-File -Encoding UTF8 $folderListPath

Write-Host "Folder list saved to $folderListPath" `

This will give you a tab-separated list of folder IDs and titles, making it easy to identify which ones you want to move.


🧩 Part 2: Move Selected Folders to a New Parent

Once you've selected the folder IDs you want to move, you can use this second PowerShell script. Just update the $targetParentId and $foldersToMove array:

`powershell

Define the target parent folder ID $targetParentId = "your-target-folder-id-here"

List of folder IDs to move $foldersToMove = @( "folder-id-1", "folder-id-2", "folder-id-3" # Add more as needed )

Move each folder foreach ($folderId in $foldersToMove) { joplin mv $folderId $targetParentId Write-Host "Moved folder $folderId to $targetParentId" } `


🧠 Tips for Smooth Execution

  • Make sure the Joplin CLI is installed and authenticated (joplin config to check).
  • You can run joplin list folders --json manually to inspect the structure before scripting.
  • If you're syncing via file system or using portable mode, ensure the CLI is pointing to the correct profile.
Report abuse