Replies: 4 comments
-
I use a script that runs rsync twice: once for notes and once for images: #!/bin/bash
rsync -vi -rlD -O -c --delete --stats \
--include "*/" \
--exclude bestiary/bestiary.md \
--exclude items/potion-of-resistance.md \
--exclude items/chromatic-rose.md \
--exclude items/armor-of-resistance.md \
--include="*.md" \
--exclude="*" \
/Users/elh/adventures/compendium/dm/compendium/5e/ \
/Users/elh/adventures/campaign-notes/compendium/5e
rsync -vi -rlD -O --ignore-existing --delete --stats \
--include "*/" \
--exclude="*.md" \
--include="*" \
/Users/elh/adventures/compendium/dm/compendium/5e/ \
/Users/elh/adventures/campaign-notes/compendium/5e In both cases, I'm asking rsync to delete files that have been deleted (I'll correct any referencing notes later, but it cleans up duplicates or moved files that I didn't otherwise catch).
That's the gist, assuming I did everything right. ;) |
Beta Was this translation helpful? Give feedback.
-
I've also been running 5etools via bash script. The following will let me build a compendium, and I can add a Otherwise the rsync command is pretty similar to @ebullient (explained really clearly above). And as I found out the hard way, don't use #!/bin/bash
rm -rf "/5e-cli-compendium/DnD-cli-out" &&
java -jar /bin/ttrpg-convert-cli/target/ttrpg-convert-cli-299-SNAPSHOT-runner.jar --index \
-c '/5e-cli-compendium/config.json' \
-o '/5e-cli-compendium/DnD-cli-out' \
'/5etools-mirror.nosync/data' \
'/5etools-homebrew.nosync/creature/Kobold Press; Creature Codex.json' \
'/5etools-homebrew.nosync/creature/Kobold Press; Tome of Beasts.json'
while getopts 'ct' OPTION; do
case "$OPTION" in
c)
echo "copy (rsync) compendium files" && \
rsync -vi -rlcD -O --delete --stats \
"/5e-cli-compendium/DnD-cli-out/5e-compendium" \
"/ObsidianVault/Rules & Options/"
;;
t)
echo "trash compendium files" && \
trash "/5e-cli-compendium/DnD-cli-out"
;;
?)
echo "script usage: $(basename \$0) [-c] [-t]" >&2
exit 1
;;
esac
done |
Beta Was this translation helpful? Give feedback.
-
I know this is old, but wanted to contribute what I ended up using for my setup, as it is relatively user-friendly, which may be ideal for novices like myself: FreeFileSync is a free software for copying folders and files that has both a FreeFileSync and WinMerge together have worked well for identifying numerous unexpected changes and even some bugs (that have since been reported and resolved) since I started using the CLI tool, as well as being very seamless for folder synchronization. |
Beta Was this translation helpful? Give feedback.
-
I started using this powershell script since every time I wanted to update the CLI output I needed to run several things. This will take care of running Here's how my file structure looks like:
<#
.SYNOPSIS
Pull latest data, regenerate Markdown, dump all Output contents
into the vault root.
.PARAMETER Copy
Move generated files in 'Output' to the campaign folder
#>
param(
[switch]$Copy
)
# —————————————————————————————————————————
# Paths (all relative to vault root)
# —————————————————————————————————————————
$vaultDir = $PSScriptRoot # …\dndcampaign
$vaultCli = Join-Path $vaultDir '3-Mechanics\CLI' # …\dndcampaign\3-Mechanics\CLI : Current Output of the CLI Process
$parentDir = Split-Path $vaultDir -Parent # …\Documents
$cliDir = Join-Path $parentDir 'CLI' # …\Documents\CLI
$dataRepoSrc = Join-Path $cliDir '5etools-src' # …\CLI\5etools-src
$dataDir = Join-Path $dataRepoSrc 'data' # …\5etools-src\data
$dataRepoImg = Join-Path $cliDir '5etools-img' # …\CLI\5etools-img
$output = 'Output'
$configJson = 'dm-sources.json'
$outputDir = Join-Path $cliDir $output # …\CLI\Output
$exe = Join-Path $cliDir 'ttrpg-convert.exe'
# —————————————————————————————————————————
# Update data and images repo
Write-Host "- Pulling latest in $dataRepoSrc"
git -C $dataRepoSrc pull
Write-Host "- Pulling latest in $dataRepoImg"
git -C $dataRepoImg pull
# Remove old build
if (Test-Path $outputDir) {
Write-Host "- Removing old Dir folder..."
Remove-Item $outputDir -Recurse -Force
}
if ($Copy -and (Test-Path $vaultCli)) {
Write-Host "- Removing old CLI output from Vault"
Remove-Item $vaultCli -Recurse -Force
}
# Run the converter
Write-Host "Running converter in $cliDir..."
Push-Location $cliDir
try {
& $exe --index -o $output -c $configJson $dataDir
}
finally {
Pop-Location
}
if ($Copy) {
# Dump contents of Output into root directory of vault
Write-Host "`nCopying everything from Output -> Vault"
# This copies *all* files & subfolders inside Output directly into the vault folder
robocopy $outputDir $vaultDir /E /NP /NFL /NDL
}
Write-Host "All done." Ran by opening powershell in the vault directory and running |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Copying files into your vault is a necessary task, but there can be some nuance to it.
I'd like to compare notes!
Beta Was this translation helpful? Give feedback.
All reactions